File tree 1 file changed +14
-2
lines changed
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):
57
57
"""Convert mpl line symbol to plotly line symbol and return symbol."""
58
58
if mpl_dash in DASH_MAP :
59
59
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'
62
70
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
63
75
64
76
def convert_path (path ):
65
77
verts = path [0 ] # may use this later
You can’t perform that action at this time.
0 commit comments