How could I plot a plane curve (either the graph of a function or an implicit plot) so that where the curve leaves the bounds of the plot, an arrow in the tangent direction is added?
I'm trying to produce plots for quiz and exam questions that are similar to ones you see in many calculus books where arrows are added to the ends of the curve to indicate that the curve continues in a certain direction "off the screen".
I've searched sage-support, the manual, and the documentation without much success. Perhaps I'm searching for the wrong term. Searching for "arrow" and "plot" or "curve" hasn't gotten me anywhere. I've also looked through examples in the matplotlib gallery, but I don't see any examples of what I want there.
I can imagine writing code myself to add such arrows to a plot, but I'm sure someone has thought about and implemented this before.
Here's a quick hack. With the code given by example (I'm not the best sage/python programmer)
Here's a similar method for an implicit plot
I' have thought about this, but I have to admit it was only when I was reading the TikZ/PGF Manual, which remarks that perhaps the reason arrow tips are missing from so many scientific diagrams is simply that people can't figure out how to draw them :)
So I don't know how to do it in Sage, but I'll say that I use TikZ for my quiz/exam diagrams, and maybe this would make sense for you too if you're already texing them. If you've never used it before, here are a couple of examples that I thought were particularly relevant:
These are probably more complicated than what you want to do -- the manual is really a very good place to start. Sorry this doesn't tell you how to get arrow tips in Sage, but maybe this non-answer will provoke someone who does know how to do it :)
As far as I know, the plotting in Sage is done by matplotlib. I browsed through the matplotlib docs and couldn't find anything about arrows at the ends of curves. The docs also contain a gallery of examples, and I didn't see any suitable examples. In any case, I think matplotlib is the place to look; if matplotlib can do it, then Sage probably can, but if matplotlib can't then Sage can't.
Asked: Feb 19 '11
Seen: 589 times
Last updated: Feb 22 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.