Axes labels in 3d plots not showing
Example is here - Axes 3d example
Hi
I propose this workaround not quite satisfactory (w2 is out of place)
from sage.manifolds.utilities import set_axes_labels
w, w1, w2, p, a = var('w w1 w2 p a')
U(w, a) = w^a # La fonction doit être fonction de ses variables et paramètres
a = 0.6
p = 0.5
f = p * U(w1, a) + (1 - p) * U(w2, a)
G = plot3d(f, (w1, 1e-4, 5), (w2, 1e-4, 5), frame=False, color='wheat', opacity=0.6)
G += arrow3d((0, 0, 0), (5, 0, 0), color='green')
G += arrow3d((0, 0, 0), (0, 5, 0), color='green')
G += arrow3d((0, 0, 0), (0, 0, 3), color='green')
G += text3d("$U(w) = w^a$", (1, 2, 3), color=(0.5, 0, 0))
G += set_axes_labels(G, 'w1','w2','U', color='green', fontweight='bold')
show(G,viewer='threejs',frame=True)
contour_plot(f, (w1, 0, 5), (w2, 0, 5))
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2021-10-11 19:37:35 +0100
Seen: 365 times
Last updated: Oct 12 '21
Note that the axes labels are there, but they are lying on edges opposite to the axes arrows. This results from some threejs convention, if I remember correctly. The axes labels are controlled by the options
axes_labels
andaxes_labels_style
that can be passed toplot3d
andshow
functions; see the threejs viewer documentation for details.