Untitled

1118 days ago by pub

Wikipages: plot3d- specifically lists 3d plot options

Options for plot3d. Click and drag the graphs to rotate!

Minimum syntax: plot3d( f(x,y) , (x,xmin,xmax) , (y,ymin,ymax) )

plot3d() plots a function of type z=f(x,y) in a 3d plot. You must first declare the 2 variables and use the minimum syntax. Everything else is optional.

Options: color, opacity, figsize, aspect_ratio, frame, mesh, dots, plot_points, axes, adaptive

Required elements for plot3d

#Remember that you need to declare any variables used in functions. #We declare the variables x and y since they are the "standard" variables for explicit 3d functions z=f(x,y). var ('x y') plot3d(y^3-x,(x,0,3),(y,-1,1))

If you name the plot, then you must use the command show() to plot the plot.

You can name the variables whatever you want, but they are always cartesian with plot3d.

var ('rho phi') f=(phi^3-rho) rho1=0; rho2=3 S = plot3d(f,(rho,rho1,rho2),(phi,-1,1)) show(S)

You can define and show more than 1 plot with show().  See graphs at end for more options like this.

var ('x y') S1=plot3d(y^3-x,(x,0,3),(y,-1,1)) S2=plot3d(y,(x,0,3),(y,-1,1), color='red') show(S1+S2)

The order of the ranges is important! The first variable named in the range is the "left axis", the second variable is the "right axis". It doesn't matter what you call them (or in what order you define them).

We reversed the order of the ranges given so y has become the 1st-axis and x has become the 2nd-axis.

var ('x y') plot3d(y^3-x,(y,-1,1), (x,0,3))

Defaults: color='blue' and opacity=1 (opaque) and figsize=4 (see above).

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),color='red', opacity=0.3, figsize=2)

Default: aspect_ratio is "fit it into the figsize" and aspect_ratio and figsize are related (haven't quite worked out how - see both graphs below).

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),rgbcolor=(1,.5,1), opacity=0.3, figsize=2, aspect_ratio=[1,1,1])

rgbcolor(0,0,0)=(0,0,0) = 'black'; rgbcolor=(1,1,1) = (255,255,255) = 'white'. (To make something invisible, use opacity=0.)

Here we make our figure 'green' and revert to default figsize=4.

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),rgbcolor=(0,.6,0), opacity=0.6, aspect_ratio=[1,1,1])

Default: frame=True .

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),rgbcolor=(0,.6,0), opacity=0.6, aspect_ratio=[1,1,1], frame=False)

*** Default: mesh=False is the default. But I don't see the mesh when it is true. This is a "known problem". January 2012

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),aspect_ratio=[1,1,1], mesh=True)

*** Default: dots=False is the default. But I don't see the dots (at the grid points) when it is true. This is a "known problem". January 2012

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),aspect_ratio=[1,1,1], dots=True)

*** Default: plot_points is automatic. Since we cannot see the mesh, hard to tell. But I don't see the 2 integer option working. This is a "known problem". January 2012

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1),aspect_ratio=[1,1,1], plot_points=[3,6])

I don't know how the following works. I found it at: http://www.sagemath.org/doc/reference/sage/plot/plot3d/plot3d.html

I DO know that you need BOTH options. Neither works separately.  The 2nd graph takes FOREVER to generate.

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1), adaptive=True, color=['red','yellow'])
var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1), adaptive=True, color=rainbow(50, 'rgbtuple'), max_bend=.1, max_depth=15)

*** Default: axes=False is the default. I don't like the axes when true. See 2nd graph for a better option (in my opinion).

var ('x y') plot3d(y^3-x, (x,0,3),(y,-1,1), aspect_ratio=[1,1,1], axes=True)
var ('x y') S=plot3d(y^3-x, (x,0,3),(y,-1,1), aspect_ratio=[1,1,1], color='purple', opacity=0.5) var ('t') Ax=parametric_plot(vector((t,0,0)),(t,0,3), thickness=3, color='red') Ay=parametric_plot(vector((0,t,0)),(t,-1,1), thickness=3, color='blue') Az=parametric_plot(vector((0,0,t)),(t,-4,1), thickness=3, color='green') show(S+Ax+Ay+Az)
var ('x y') S=plot3d(y^3-x, (x,0,3),(y,-1,1), aspect_ratio=[1,1,1], color='purple', opacity=0.5) var ('t') Ax=parametric_plot(vector((t,0,0)),(t,0,3), thickness=3, color='red') Ay=parametric_plot(vector((0,t,0)),(t,-1,1), thickness=3, color='blue') Az=parametric_plot(vector((0,0,t)),(t,-4,1), thickness=3, color='green') p1=point3d((1.0,0.0,0.0),size=30, rgbcolor=(0,1,0)) show(S+Ax+Ay+Az+p1)