Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Apart from not being able to fine-tune the axes, Sage's 3d plots don't support pdf output at this point.

You can use matplotlib (which is part of Sage) to create pseudo-3d plots with pdf output. Here is an example of how to do a 3d point plot with matplotlib and fiddle with the axes:

sage: points = [(-3, -2, 4), (0, 1, 0), (1, 0, 0), (2, 1, -4)]
sage: from mpl_toolkits.mplot3d import axes3d
sage: import matplotlib.pyplot as plt
sage: from matplotlib import rc
sage: rc('text', usetex=True)
sage: fig = plt.figure()
sage: fig.set_figwidth(13.0/2.54)
sage: fig.set_figheight(9.0/2.54)
sage: ax = axes3d.Axes3D(fig)
sage: ax.scatter3D(*zip(*points), s=50, c='red')
<mpl_toolkits.mplot3d.art3d.Patch3DCollection object at 0x6386750>
sage: ax.set_xlabel(r'$X$')
<matplotlib.text.Text object at 0x620d750>
sage: ax.set_xlim3d(-3, 2)
(-3, 2)
sage: ax.w_xaxis.get_major_locator()._integer = True
sage: for t in ax.w_xaxis.get_ticklabels(): t.set_fontsize(6)
....: 
sage: plt.savefig('/tmp/my_figure.pdf', bbox_inches='tight')