Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a dashed line using Matplotlib's ConnectionPatch?

How can I change the linestyle of the line drawn by the ConnectionPatch? It would be best if the usual linestyles ":", "--", or "-" would work. The ConnectionPatch code I was using is:

con = ConnectionPatch(color=seas_col[iseas],linewidth=2,
   xyA=(mean_vals_1[isn,iseas],0), 
   xyB=(mean_vals_2[isn,iseas],3000), 
   coordsA="data", coordsB="data",
   axesA=axarr[0], axesB=axarr[1])

Both the arrowstyle and connectionstyle don't accept the above mentioned styles.

Example Fig, the connection lines should match the above linestyles.

like image 648
Andre Avatar asked Jul 25 '26 12:07

Andre


1 Answers

The answer is not to use the short hand notation, but the long forms, e.g. "dotted","dashed","solid" which work for the linestyle keyword.

like image 124
Andre Avatar answered Jul 28 '26 02:07

Andre