how to realize 'contour' plotting with different spacings?

3 views (last 30 days)
I want to visualize the potential field of the Earth-Moon system. When I used the contour command, the contour lines which close to the Earth is too dense (see fig.1)
contour( x_EM2 , y_EM2 , V_matrix' , 100 )
If I reduce the quantity of the isolines, the isolines which close to the Moon will vanish (see fig.2).
contour( x_EM2 , y_EM2 , V_matrix' , 20 )
How to realize 'contour' plotting with different spacings or any idea of reducing the isolines close to the Earth without any lost of isolines close to the Moon?
Best Wishes

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 28 May 2015
Instead of calling the function with 100 to get 100 iso-spaced contourlines you should calculate the potential-levels of interest and give that array:
C_levels = C0./linspace(r0,rmax,100); % where C0 R0 and rmax are for you to choose
contour( x_EM2 , y_EM2 , V_matrix' , C_levels )
HTH
  2 Comments
Yifan
Yifan on 28 May 2015
Thanks a lot! Follow your answer, I can even define a vector of isolates' values which I want to plot. Here is the result:
isolines = [1100000, 1300000, 1600000, 1900000, 2300000, 3000000, 4000000, 6000000, 9000000, 13000000, 25000000] ;
[C, h] = contour( x_EM2 , y_EM2 , V_matrix' ,isolines ) ;
clabel(C, h, 'labelspace', 100000000) ;
Vaibhavi Kavathekar
Vaibhavi Kavathekar on 9 Feb 2022
Edited: Vaibhavi Kavathekar on 9 Feb 2022
Okay , I'm trying to do the same for my contour plot, just not able to figure out how should I choose values for C0,R0,Rmax. Not clear with what the C_levels func is doing.

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!