Here's a question about changing the viewpoint in a 3d plot:

----- Forwarded message from "Gagnon, Jacob A" -----
> Thanks. The server is up now. I have quick question about plot3d. If
> you try my interact at http://users.wpi.edu/~jgagnon/sagetest.html
> with parameters 0, 0, 0.75, 2, 2, then the orientations of the contour
> plot and 3d plot are not aligned. How do I make the default
> orientation of the 3d plot be a XY plane view with an additional
> slight rotation about the x axis? I would like to do this
> automatically instead of right click view XY plane and then rotate
> about the x axis with the mouse.

The relevant code is:

@interact
def _(mux=slider(-2,2,0.5,default=0,label='mux'),muy=slider(-2,2,
0.5,default=0, label='muy'),rho=slider(-0.75,.75, 0.25,default=0,
label='rho'),sx=slider(0.1,2, 0.1,default=1,
label='sx'),sy=slider(0.1,2, 0.1,default=1, label='sy')):
    f(x,y) =
    
1/(2*pi*sx*sy*sqrt(1-rho^2))*exp(-1/(2*(1-rho^2))*((x-mux)^2/sx^2+(y-muy)^2/sy^2-2*rho*(x-mux)*(y-muy)/sx/sy))
    g(x)=f(y=0)
    h(y)=f(x=0)
    p1=contour_plot(f(x,y),(x,-5,5),(y,-5,5),cmap='hsv')
    p2=plot3d(f(x,y),(x,-5,5),(y,-5,5))
    p3=plot(g(x),(x,-5,5))
    p4=plot(h(y),(y,-5,5))
    show(p1,figsize=3)
    show(p2,figsize=3)


Do we have a way of specifying a viewpoint when doing a 3d plot?

Dan

--
---  Dan Drake
-----  http://mathsci.kaist.ac.kr/~drake
-------

Attachment: signature.asc
Description: Digital signature

Reply via email to