File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,21 @@ def convert_dash(mpl_dash):
5757 """Convert mpl line symbol to plotly line symbol and return symbol."""
5858 if mpl_dash in DASH_MAP :
5959 return DASH_MAP [mpl_dash ]
60- else :
61- return 'solid' # default
60+ else :
61+ dash_array = mpl_dash .split (',' )
62+
63+ if (len (dash_array ) < 2 ):
64+ return 'solid'
65+
66+ # Catch the exception where the off length is zero, in case
67+ # matplotlib 'solid' changes from '10,0' to 'N,0'
68+ if (math .isclose (float (dash_array [1 ]), 0. )):
69+ return 'solid'
6270
71+ # If we can't find the dash pattern in the map, convert it
72+ # into custom values in px, e.g. '7,5' -> '7px,5px'
73+ dashpx = ',' .join ([x + 'px' for x in dash_array ])
74+ return dashpx
6375
6476def convert_path (path ):
6577 verts = path [0 ] # may use this later
You can’t perform that action at this time.
0 commit comments