How do I graph a line in Julia with an arrow on both sides?

Here is my code:

using MTH229
using Plots

Here is a picture of the output:


How do I get the arrow to appear on both ends of the line instead of just one?

>Solution :

It’s a bit of a hacky solution, but for the example in the question:

plot!([-4.99,-5],[f(-4.99), f(-5)],

adds the reverse arrow. Generalizing to any chart is pretty straight forward. The idea is to draw a line chart with a reverse direction, for just a tiny bit at the location of the reverse arrow and let Plot add the reverse arrow.

Chart with reverse arrow

Leave a Reply