Ask Your Question
1

Axes labels in 3d plots not showing

asked 2021-10-11 19:37:35 +0200

jaqatra gravatar image

Example is here - Axes 3d example

edit retag flag offensive close merge delete

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 ( 2021-10-13 21:47:57 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2021-10-12 11:34:46 +0200

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))
edit flag offensive delete link more

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 ( 2021-10-13 22:31:18 +0200 )edit

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: 2021-10-11 19:37:35 +0200

Seen: 33 times

Last updated: Oct 12