-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add facet_col and animation_frame argument to imshow #2746
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
afb5c4d
use init_figure from main px core
emmanuelle 8be8ca0
WIP: add facet_col arg to imshow
emmanuelle d236bc2
animations work for grayscale images, with or without binary string
emmanuelle c8e852e
animations now work + tests
emmanuelle 12cec34
docs on facets and animations + add subplots titles
emmanuelle ab427ae
Merge branch 'master' into imshow-animation
emmanuelle 7a3a9f4
solved old unnoticed conflict
emmanuelle b689a2f
attempt to use imshow with binary strings and xarrays
emmanuelle fbb3f65
added test
emmanuelle 882810f
animation work for xarrays, still need to fix slider label
emmanuelle ba65990
added test with xarray and animations
emmanuelle cf644e5
added doc
emmanuelle 72674b7
added pooch to doc requirements
emmanuelle bd42385
Update packages/python/plotly/plotly/express/_imshow.py
emmanuelle fc2375b
Update doc/python/imshow.md
emmanuelle a431fad
remove commented-out code
emmanuelle b652039
animation + facet kinda working now, but it broke labels
emmanuelle 59c6622
added test
emmanuelle c7285a3
simplified code
emmanuelle 91c066e
simplified code
emmanuelle ac5aa1f
polished code and added doc example
emmanuelle 36b9f98
Merge branch 'imshow-animation' of https://github.com/plotly/plotly.p…
emmanuelle 8cdc6af
updated doc
emmanuelle cf1c2b9
Merge branch 'master' into imshow-animation
emmanuelle 5d1d8d8
add facet_col_spacing and facet_row_spacing
emmanuelle c27f88a
modify error message + animation_frame label
emmanuelle 502fdfd
improve code readibility
emmanuelle 135b01b
added example with sequence of images
emmanuelle 6ac3e36
typoe
emmanuelle a5a2252
label names
emmanuelle 77cb5cd
label name
emmanuelle 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
improve code readibility
- Loading branch information
commit 502fdfd5178788ecd6f37872ced5da4e1db132d0
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -522,14 +522,13 @@ def imshow( | |
slice_label = "slice" if labels.get("facet") is None else labels["facet"] | ||
col_labels = ["%s = %d" % (slice_label, i) for i in facet_slices] | ||
fig = init_figure(args, "xy", [], nrows, ncols, col_labels, []) | ||
layout_patch = dict() | ||
for attr_name in ["height", "width"]: | ||
if args[attr_name]: | ||
layout_patch[attr_name] = args[attr_name] | ||
layout[attr_name] = args[attr_name] | ||
if args["title"]: | ||
layout_patch["title_text"] = args["title"] | ||
layout["title_text"] = args["title"] | ||
elif args["template"].layout.margin.t is None: | ||
layout_patch["margin"] = {"t": 60} | ||
layout["margin"] = {"t": 60} | ||
|
||
frame_list = [] | ||
for index, trace in enumerate(traces): | ||
|
@@ -547,7 +546,6 @@ def imshow( | |
if animation_frame: | ||
fig.frames = frame_list | ||
fig.update_layout(layout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a bit odd to have |
||
fig.update_layout(layout_patch) | ||
# Hover name, z or color | ||
if binary_string and rescale_image and not np.all(img == img_rescaled): | ||
# we rescaled the image, hence z is not displayed in hover since it does | ||
|
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.
the PX default behaviour here is to have the label be called
facet_col
and have it be overrideable vialabels["facet_col"]
OR to have it be the value offacet_col
(i.e. "day of week") and have it be overrideable vialabels["day of week"]
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.
we can maybe leave this out for now/do it later...
px.imshow
already doesn't do this for x/y/color and it mostly only applies in the case of xarray.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.
yes exactly here we don't have column names, and the case of xarrays is handled correctly I think. So I can leave it like this?