(matplotlylib) Make convert_dash more robust to changes in matplotlib.#938
Merged
jackparmer merged 1 commit intoplotly:masterfrom Mar 1, 2018
nburrus:convert-dash
Merged
(matplotlylib) Make convert_dash more robust to changes in matplotlib.#938jackparmer merged 1 commit intoplotly:masterfrom nburrus:convert-dash
jackparmer merged 1 commit intoplotly:masterfrom
nburrus:convert-dash
Conversation
Now handles the case where the dashes are scaled, have floating-point values, or were customized with `dashes=(N,M)`.
Contributor
|
👍 LGTM. Thanks for taking the time to contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_plotlyin 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 theDASH_MAPinmpl_tools.pyhas a set of hardcoded values, which I imagine changed with recent versions ofmatplotlib.With linestyle='--', I was getting values like '7.4,3.2' which would not match the
6,6of the match. Forcingdash=(6,6)would still not work because thempl_dashstring 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.