Setting dash length when plotting arrow

matplotlib, python

Solution

Currently, I don't think it possible as the `Arrow` class only supports `'solid' | 'dashed' | 'dashdot' | 'dotted'` four different linestyles. In order to be able to use a customized dash style, the object must have `._dashSeq` property, which `Arrow` lacks. Therefore I can see the reason why `.set_dashes`.

That being said, currently even though the `.set_linestyle` method is provided for `Arrow`, you can't, say, set to anything other than the 4 styles listed above. That means things such as `.set_linestyle('-')` is not possible.

Problem

With matplotlib its easy to plot a line with a customised dash style using ``` plt.plot([0, 5], [0, 5], dashes=(20.0, 20.0)) plt.show() ``` or ``` lines = plt.plot([0, 5], [0, 5]) lines[0].set_dashes((20.0, 20.0)) plt.show() ``` and while its possible to plot arrows with a dashed style ``` plt.arrow(0, 0, 5, 5, linestyle='dashed') plt.show() ``` I can't seem to figure out how to plot arrows with a custom dash style ``` arrow = plt.arrow(0, 0, 5, 5) ? plt.show() ``` as using the plot function's `dashes` parameter gives ``` AttributeError: 'FancyArrow' object has no attribute 'set_dashes' ``` and as the error mentions the returned `FancyArrow` has no `set_dashes()` method. Is it possible?

Original source