Ask Your Question
1

Axes labels in 3d plots not showing

asked 3 years ago

jaqatra gravatar image

Example is here - Axes 3d example

Preview: (hide)

Comments

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 and axes_labels_style that can be passed to plot3d and show functions; see the threejs viewer documentation for details.

eric_g gravatar imageeric_g ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

ortollj gravatar image

Hi

I propose this workaround not quite satisfactory (w2 is out of place)

eric_g workaround

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))
Preview: (hide)
link

Comments

Thanks for pointing out that w2 is out of place! I've opened the ticket #32685 to fix this. This results from a different convention between Jmol (the previous Sage's default 3D viewer) and threejs (the current 3D viewer)

eric_g gravatar imageeric_g ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 392 times

Last updated: Oct 12 '21