3D Axes

Sometimes in calculus, it is useful to see the x, y, and z axes in a 3D plot.  This can be done with the following code, and then the axes can be combined with the plot using Show.  Sometimes, because of the ViewPoint, the label on the z-axis will be reversed.  Putting tick marks on the axes is a project for the future.

<<:Graphics:ParametricPlot3D.m

The axes for the plots shown below were obtained using {-5,5} as the response for each Input box.

{xmin,xmax} = Input["Enter the minimum and maximum 
	values for the x-axis:"];
{ymin,ymax} = Input["Enter the minimum and maximum 
	values for the y-axis:"];
{zmin,zmax} = Input["Enter the minimum and maximum 
	values for the z-axis:"];
axes = Show[
  Graphics3D[
   {Thickness[0.0075],
   Line[{{xmin,0,0},{xmax,0,0}}],
   Line[{{0,ymin,0},{0,ymax,0}}],
   Line[{{0,0,zmin},{0,0,zmax}}],
   Line[{{xmax,0,0},{.95 xmax,0,0.05 zmax}}],
   Line[{{xmax,0,0},{.95 xmax,0,-0.05 zmax}}],
   Line[{{0,ymax,0},{0,.95 ymax,0.05 zmax}}],
   Line[{{0,ymax,0},{0,.95 ymax,-0.05 zmax}}],
   Line[{{0,0,zmax},{0.05 xmax,0,.95 zmax}}],
   Line[{{0,0,zmax},{-0.05 xmax,0,.95 zmax}}],
   PointSize[0.01],
   Point[{0,0,0}],
   Thickness[0.004],
   Line[{{1.05 xmax,0,.05 zmax},{1.1 xmax,0,.1 zmax}}],
   Line[{{1.05 xmax,0,.1 zmax},{1.1 xmax,0,.05 zmax}}],
   Line[{{0,1.05 ymax,.1 zmax},{0,1.075 ymax,.05 zmax}}],
   Line[{{0,1.1 ymax,.1 zmax},{0,1.05 ymax,0}}],
   Line[{{-.025 xmax,0,1.05 zmax},{.025 xmax,0,1.05 zmax}}],
   Line[{{-.025 xmax,0,1.1 zmax},{.025 xmax,0,1.1 zmax}}],
   Line[{{-.025 xmax,0,1.05 zmax},{.025 xmax,0,1.1 zmax}}]}],
	Boxed->False,
	PlotRange->{{.7 xmin,.7 xmax},{.7 ymin,.7 ymax},
		{.8 zmin,.8 zmax}}]

surf = Graphics3D[Plot3D[x-x^3/12-y^2/4+1/2,
																								{x,-4,4},{y,-4,4}]]

Show[surf,axes]

Show[%, ViewPoint->{1.300, -2.400, 2.000}]