Get an SVG dash array for the given matplotlib linestyle Parameters ---------- obj : matplotlib object The matplotlib line or path object, which must have a get_linestyle() method which returns a valid matplotlib line code Returns ------- dasharray : string
(obj)
| 54 | |
| 55 | |
| 56 | def get_dasharray(obj): |
| 57 | """Get an SVG dash array for the given matplotlib linestyle |
| 58 | |
| 59 | Parameters |
| 60 | ---------- |
| 61 | obj : matplotlib object |
| 62 | The matplotlib line or path object, which must have a get_linestyle() |
| 63 | method which returns a valid matplotlib line code |
| 64 | |
| 65 | Returns |
| 66 | ------- |
| 67 | dasharray : string |
| 68 | The HTML/SVG dasharray code associated with the object. |
| 69 | """ |
| 70 | if obj.__dict__.get("_dashSeq", None) is not None: |
| 71 | return ",".join(map(str, obj._dashSeq)) |
| 72 | else: |
| 73 | ls = obj.get_linestyle() |
| 74 | dasharray = LINESTYLES.get(ls, "not found") |
| 75 | if dasharray == "not found": |
| 76 | warnings.warn( |
| 77 | "line style '{0}' not understood: defaulting to solid line.".format(ls) |
| 78 | ) |
| 79 | dasharray = LINESTYLES["solid"] |
| 80 | return dasharray |
| 81 | |
| 82 | |
| 83 | PATH_DICT = { |
no test coverage detected