-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matplotlylib fixes #3143
Merged
Merged
Matplotlylib fixes #3143
Changes from 1 commit
Commits
Show all changes
128 commits
Select commit
Hold shift + click to select a range
c4068d1
assign Figure object to a variable
Pascalco 40b9af1
WIP accelerated encoding with orjson
jonmmease f79e318
support fig to dict in io without cloning
jonmmease 55720de
Merge branch 'master' into orjson_encoding
jonmmease 7b3593a
fix clone default
jonmmease da915d6
Add pio.json.config object to configure default encoder
jonmmease 7b235ef
default_encoder to default_engine
jonmmease 7895b6a
blacken
jonmmease ce05a68
Handle Dash objects in to_json
jonmmease 3ed5058
feature/include_plotlyjs uses bundles js version, new cdn-latest option
adehad 49a777d
fix other tests that are broken by new 'cdn' option behaviour
adehad 5553f89
make cdn url generator not test exclusive
adehad 4ada560
add new `include_plotlyjs='cdn'`behaviour to changelog
adehad 023ee57
fix tests after poor refactor
adehad 12db5cb
format after using right black version
adehad 7e4b256
format changelog entry better
adehad 4ef6510
add JSON encoding tests
jonmmease 101ba85
add testing of from_plotly_json
jonmmease 67d3670
Better error message when orjson not installed and orjson engine requ…
jonmmease 02c00da
Add orjson as optional testing dependency
jonmmease 99ea6a1
Replace Python 3.5 CI tests with 3.8
jonmmease d44ec26
Try only install orjson with Python 3.6+
jonmmease b7d8422
Don't test orjson engine when orjson not installed
jonmmease ddcd6f5
Try new 3.8.7 docker image since prior guess doesn't exist
jonmmease 33359f3
greater than!
jonmmease c7c1819
Bump scikit image version for Python 3.8 compatibility
jonmmease a8d52ab
Try to help Python 2 from getting confused about which json module to…
jonmmease 619838f
Update pandas for Python 3
jonmmease 7c7a272
Revert 3.8 CI updates. Too much for this PR
jonmmease 1708703
Doh
jonmmease 66cab10
Don't skip copying during serialization
jonmmease 56a8945
Rename new JSON functions:
jonmmease 0a51020
Ensure cleaned numpy arrays are contiguous
jonmmease 4e9d64e
Use to_json_plotly in html and orca logic
jonmmease d4068de
Add orjson documentation dependency
jonmmease 58b7192
Handle pandas Timestamp scalars in orjson engine
jonmmease 974fcba
Rework date and string encoding, add and fix tests
jonmmease a651a63
default JSON engine to "auto"
jonmmease af1d88d
Fix expected JSON in html export (no spaces)
jonmmease 1d6acc3
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease d51fd94
blacken
jonmmease 042c54c
Fix expected JSON in matplotlylib test
jonmmease ddc1b8f
Fix expected JSON in html repr test
jonmmease 6e6bd44
Update figure-introspection.md
nicolaskruchten d7928b0
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease 76cc625
Don't drop timezones during serialization, just let Plotly.js ignore …
jonmmease 453461d
Merge branch 'numpy_date_serialization' into orjson_encoding
jonmmease 84ba4b5
no need to skip legacy tests now
jonmmease 340aed3
Only try `datetime_as_string` on datetime kinded numpy arrays
jonmmease ef60cf5
Update configuration-options.md
nicolaskruchten 6cea61d
Don't store object or unicode numpy arrays in figure. Coerce to lists
jonmmease 93815c1
Try orjson encoding without cleaning first
jonmmease 242d1fa
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease 8a3a4b3
blacken
jonmmease 1de750a
remove scratch file
jonmmease 81f73d5
Remove unused clone
jonmmease 80be8bd
Remove the new "json" encoder
jonmmease cb54f88
Reorder dict cleaning for performance
jonmmease 62a0ad1
Update troubleshooting.md
nicolaskruchten 1b81b0b
fixing documents
c-chaitanya bb4a47c
Merge pull request #3073 from c-chaitanya/doc-prod
nicolaskruchten f5fbc16
document corrections
c-chaitanya c944597
document corrections
c-chaitanya 249fef0
Update imshow.md
c-chaitanya c596d2e
Merge pull request #3079 from c-chaitanya/doc-prod
nicolaskruchten 7b6a594
Adds function to sample colorscales
CarlAndersson 0a0fc05
fixed test and mpl 3.4.1 compatibility
fdion 4a250fa
added drawing of legend shapes (lines, markers)
fdion 8627242
Merge branch 'doc-prod'
nicolaskruchten 77b07c5
latex docs (#3157)
nicolaskruchten db22c9d
Merge branch 'doc-prod'
nicolaskruchten 6387cb3
remove latex redirections
nicolaskruchten 9377627
correct misspells, fix #3074 (#3105)
jmonticolo 8caa7a9
Update dot-plots with mislabeled data (#3063)
acmiyaguchi 211e1f6
Bump y18n from 3.2.1 to 3.2.2 in /packages/javascript/plotlywidget (#…
dependabot[bot] 0142290
Bump elliptic from 6.5.3 to 6.5.4 in /packages/javascript/plotlywidge…
dependabot[bot] cb82e29
Bump node-fetch from 2.6.0 to 2.6.1 in /packages/javascript/plotlywid…
dependabot[bot] 6bf5849
Replaced 'retrying' dependency with 'tenacity' in plotly package (#2911)
jmsmdy 70877b4
Require python 3.6 and CI maintenance (#3160)
jonmmease 5673b34
Kaleido v5 updates (#3094)
jonmmease f18576b
CircleCI updates: Unify requirements, drop conda, refactor to reduce …
jonmmease b343fcc
Fix selection of histograms with multiple traces (#2771)
meffmadd c60ebbc
Orca to Kaleido
chriddyp 3fc9c82
Merge pull request #3171 from plotly/chriddyp-patch-1
chriddyp 593672d
Merge JS package and create federated extension
a6c6d99
Rename and rebase
fcollonval 38d0b36
Fix CI
fcollonval 9c8e1f5
Handle pathlib.Path in pio (#2974)
maresb 1fbfa0d
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease 45fdece
Merge pull request #3142 from fcollonval/fcollonval/issue3036
nicolaskruchten 8d665ac
old file cleanup
nicolaskruchten fa292ed
Merge pull request #3184 from plotly/rm_old_files
nicolaskruchten 1b419ad
Minor fixes
CarlAndersson e774d3f
Adds tests
CarlAndersson 282ed0d
Merge remote-tracking branch 'origin/master' into colorscale-sampling
CarlAndersson fb2c139
Code formatting
CarlAndersson b597748
Implements getting a colorscale by name
CarlAndersson b6e5636
Merge pull request #3186 from CarlAndersson/get-colorscale-by-name
nicolaskruchten 2096d31
Update _html.py
Lix1993 db920c2
Merge pull request #3187 from Lix1993/master
nicolaskruchten 41a61c8
Fix a type in configuration-options doc
xldrx c9ac32e
Merge pull request #3188 from xldrx/patch-1
nicolaskruchten 10be9df
Merge branch 'master' into colorscale-sampling
CarlAndersson 1b8ec25
Handle string inputs with get_colorscale
CarlAndersson 2a59bc0
Merge pull request #3136 from CarlAndersson/colorscale-sampling
nicolaskruchten b8d7774
minor fix to get_colorscale
nicolaskruchten a33826d
black
nicolaskruchten 5e327e7
Merge pull request #3193 from plotly/fix_sample_colorscale
nicolaskruchten 4a13db6
Update figure-structure.md
nicolaskruchten 5ab8da3
Update contributing.md
nicolaskruchten 5301dcb
Merge pull request #2955 from plotly/orjson_encoding
nicolaskruchten fc9bc42
Fix typo in express/_doc.py
samorajp b0a5f77
Merge pull request #3208 from samorajp/patch-1
nicolaskruchten b4ecea0
Merge branch 'master' into lock_cdn_ver
nicolaskruchten 388d9e4
Update creating-and-updating-figures.md
nicolaskruchten be0dbc5
Merge pull request #2961 from adehad/lock_cdn_ver
nicolaskruchten d99060f
remove 'latest' CDN URLs
nicolaskruchten 9a55018
Merge pull request #3211 from plotly/rm_latest
nicolaskruchten 48da65d
bumping to JS 2.0.0 RC 2
nicolaskruchten 0895266
trying to fix sphinx
nicolaskruchten b03f0db
Merge pull request #3213 from plotly/jsrc2
nicolaskruchten 73291c0
Merge pull request #2766 from Pascalco/patch-1
nicolaskruchten fd557e4
Merge pull request #3217 from plotly/doc-prod
nicolaskruchten 5331cea
5.0.0rc1
nicolaskruchten 34d61d0
changelog
nicolaskruchten ad2b540
fixed test and mpl 3.4.1 compatibility
fdion 526d31c
added drawing of legend shapes (lines, markers)
fdion 9be781c
Merge remote-tracking branch 'origin/matplotlylib_fixes' into matplot…
fdion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what this function does... could you please explain or provide an example pair of matplotlib/plotly figures that uses this system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this function which is called further down on line 583 when coordinates are "axes" (plotly only handles "data"), the plots legends have no markers or lines, just text. This is why we get the warning: "Bummer! Plotly can currently only draw Line2D objects from matplotlib that are in 'data' coordinates!"
See example notebook here:
https://colab.research.google.com/drive/1-MNmqy_DeDxw8yPX0U7M9E8AEMtfIobP?usp=sharing
Matplotlib plot:

Plotly version:

When coordinates == axes I call my new function that draws the shapes. go.layout.Shape cant handle circles, so I handle this special case, handle lines, and everything else i pass to go.layout.shape.
Result:

It still is left with one warning: "I found a path object that I don't think is part of a bar chart. Ignoring."
This is due to the bounding box that in matplotlib is (now) a fancy box with curved corners. This would have to be addressed in a future PR.