Ask Your Question
1

How to add arrow tips to axes

asked 2024-05-30 17:04:00 +0200

Graph Karl gravatar image

I would like to have the axes displayed with arrow tips at the end. I have seen this question asked before but since that was some time ago I wondered if there is a simple way to do it now that doesn't involve plotting them manually. I appreciate the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2024-07-03 14:44:18 +0200

vdelecroix gravatar image

This is a good question! I only know of a workaround by using matplotlib

import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import AxesZero

fig = plt.figure()
ax = fig.add_subplot(axes_class=AxesZero)
for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_axisline_style('-|>')
    ax.axis[direction].set_visible(True)
for direction in ["left", "right", "bottom", "top"]:
    ax.axis[direction].set_visible(False)

P = plot(x**2, (x, 0, 1))
P.axes(False)
P_plt = P.matplotlib(figure=fig)
plt.show()

See https://matplotlib.org/stable/gallery... and https://ask.sagemath.org/question/762...

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2024-05-30 17:00:26 +0200

Seen: 262 times

Last updated: Jul 03