Skip to content

Conversation

@nburrus
Copy link

@nburrus nburrus commented Feb 18, 2018

Now handles the case where the dashes are scaled, have floating-point values, or were customized with dashes=(N,M).

Additional context: I was trying to use mpl_to_plotly in a jupyter notebook (python 3.6.3, matplotlib 2.1.2), and converting a plot with a non-solid line style (e.g linestyle='--') would still return a solid plot. It turns out that the DASH_MAP in mpl_tools.py has a set of hardcoded values, which I imagine changed with recent versions of matplotlib.

With linestyle='--', I was getting values like '7.4,3.2' which would not match the 6,6 of the match. Forcing dash=(6,6) would still not work because the mpl_dash string would become '6.0,6.0`, and still not match '6,6'.

I am new to plotly and matplotlib, so maybe I missed something, but this PR solves the issue for me, and all the line styles are now kept during the conversion, including custom dashes. It should also be somewhat robust to future changes.

Now handles the case where the dashes are scaled, have floating-point values, or were customized with `dashes=(N,M)`.
@jackparmer
Copy link
Contributor

👍 LGTM. Thanks for taking the time to contribute.

@jackparmer jackparmer merged commit 524a8a0 into plotly:master Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants