Hi, I'm preparing some function plots for a presentation and would finally like to add labels and arrows to the axes. I achieve the latter by
sage: p = plot(sin(x), -3, 3) sage: p.show(axes_labels=['$x$', '$y$']) But oddly, there seems to be no option for the show-method of a plot to add arrows to the axes. Is it that uncommon? Anyways, I added arrows "by hand" sage: p = plot(sin(x), -3, 3) sage: p += arrow((3,0), (3.5,0)) sage: p.show(axes_labels=['$x$', '$y$']) This naive approach, can't work, of course. Since now, two things happen: 1. the arrow clearly does not run til (3.5,0). It seems to end at (3.4,0) -- assuming the printed coordinate system is correct. The same happens, if I specify ... sage: p += arrow((3,0), (3.5,0), arrowshorten=0) which seems to be the default. On the other hand arrowshorten=-10 gives me an arrow running til about (3.5,0). But that's just the minor problem. 2. The coordinate system gets extended past the arrow. Which makes sense, of course, since the coordinate systems seems to get printed last -- for the complete plot including the arrow. I almost got a hold of it using axes_pad=0 sage: p = plot(sin(x), -3, 3) sage: p += arrow((3,0), (3.5,0), arrowshorten=-15) sage: p.show(axes_labels=['$x$', '$y$'], axes_pad=0) But, still the coordinate axis extends a little beyond the arrow -- contrary to axes_pad=0?! A possible solution would be, of course, to give up the coordinate system entirely and draw the two coordinate axes as arrows. Drawback: I do not want to redo the ticks and labels by hand. Another possible solution would be, to somehow change the order: plot function, draw coordinate system for the plotted function, draw arrow and keep coordinate system from before. Drawback: I do not know how to do it -- or even if it's possible. I also tried to get this done in the universe of matplotlib, but there also seems to be no need for an arrow at the end of an axis. There webpage lists the command "arrow" to "add an arrow to the axes", but the description http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.arrow and especially the example suggest, that by "axes" they mean a line and these arrows have no method for ticks or labels. I'd be glad, if somebody with more experience in plotting could help. Thanks in advance, Konstantin PS: Interestingly, in all the examples on the matplotlib page, there is not a single one, using arrows on the axes. Maybe there is a good reason to omit them, which I missed. Or, it's a culture thing. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org To unsubscribe, reply using "remove me" as the subject.