1 | initial version |
Unfortunately, the set_axes_labels
function from sage.manifolds.utilities
uses a convention different from axes
, so that the x_2
label is ill-placed. However it is easy to adapt it, from the source code that you get by typing set_axes_labels??
. Replace the last two lines of the code snippet of your example by
def set_axes_labels(graph, xlabel, ylabel, zlabel, **kwds):
from sage.plot.plot3d.shapes2 import text3d
xmin, ymin, zmin = graph.bounding_box()[0]
xmax, ymax, zmax = graph.bounding_box()[1]
dx = xmax - xmin
dy = ymax - ymin
dz = zmax - zmin
x1 = xmin + dx / 2
y1 = ymin + dy / 2
z1 = zmin + dz / 2
xmin1 = xmin - dx / 20
xmax1 = xmax + dx / 20
ymin1 = ymin - dy / 20
zmin1 = zmin - dz / 20
graph += text3d(' ' + xlabel, (x1, ymin1, zmin1), **kwds)
graph += text3d(' ' + ylabel, (xmin1, y1, zmin1), **kwds)
graph += text3d(' ' + zlabel, (xmin1, ymin1, z1), **kwds)
return graph
plot = plane + pol + axes(1, color='black')
plot = set_axes_labels(plot, 'x_1','x_2','x_3')
plot
You can also replace the last line by
show(plot, viewer='threejs')
in order to use the three.js viewer (to become the default in SageMath 9.0).