Ask Your Question
0

How to plot 2D from 3D

asked 2015-10-15 02:19:40 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I have the following code that gives a 3D graph.

f(m,p)=16*p^4*m^4-8*(18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2 - 16*p + 8)*m^2+(9*( p + 1 )^2*(p^4 - 2*p^3 + 2*p^2 + 2*p + 1)*(4*p^8 - 52*p^7 + 373*p^6 + 68*p^5 - 445*p^4 + 72*p^3 + 163*p^2 - 48*p + 9))
G = plot3d(f, (-5,5), (-10,10))
G.show(zmax=5)

How to get a 2D plot of this graph on m and p plane? I tried changing plot3d to plot2d but it did not work.

edit retag flag offensive close merge delete

Comments

1

The code above does not work for me. What exactly do you mean by a 2D plot? Do you mean a contour plot?

fidbc gravatar imagefidbc ( 2015-10-15 05:40:07 +0100 )edit

@fidbc yes i meant contour plot. by using plot3d i had a 3 dimensional region. but i want it 2 dimensional involving m and p plane.

Sha gravatar imageSha ( 2015-10-15 06:48:46 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-10-15 10:59:14 +0100

ndomes gravatar image

If you want a contour plot just use it, for example:

contour_plot(f, (m,-5,5), (p,-10,10), fill=False, plot_points=150, cmap='Spectral', contours=10)
edit flag offensive delete link more

Comments

Thank you. This worked fine for me.

Sha gravatar imageSha ( 2015-10-16 01:33:51 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-10-15 02:19:40 +0100

Seen: 447 times

Last updated: Oct 15 '15