-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
add swarm plot to the scatter documentation #5149
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
base: doc-prod
Are you sure you want to change the base?
Conversation
This is inspired by plotly#5087
I need to develop logic to "look left", spot any overlapping markers and increment the bin size potentially repeatedly if needed to avoid collisions. |
doc/python/line-and-scatter.md
Outdated
# in px. | ||
row["y"] = (row["y_slot"]//2) * \ | ||
negative_1_if_count_is_odd(row["y_slot"])*point_size*gap_multiplier | ||
print(row["y"]) |
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.
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.
Thanks for catching that debugging leftover! Removed.
doc/python/line-and-scatter.md
Outdated
fig = px.scatter( | ||
df, | ||
x="x", | ||
y="y", | ||
) | ||
# we want to suppress the y coordinate in the hover value because the | ||
# y-coordinate is irrelevant/misleading | ||
fig.update_traces( | ||
marker_size=point_size, | ||
# suppress the y coordinate because the y-coordinate is irrelevant | ||
hovertemplate="<b>value</b>: %{x}", | ||
) | ||
# we have to set the width and height because we aim to avoid icon collisions | ||
# and we specify the icon size in the same units as the width and height | ||
fig.update_layout(width=fig_width, height=( | ||
point_size*max(bin_counter.values())+200)) | ||
fig.update_yaxes( | ||
showticklabels=False, # Turn off y-axis labels | ||
ticks='', # Remove the ticks | ||
title="" | ||
) | ||
return fig |
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.
Could we give the figure a title?
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.
Good suggestion. Done!
Co-authored-by: Liam Connors <[email protected]>
This is inspired by #5087. Many thanks to @suterberg for inspiring it and getting me started.
If your PR modifies code of the
plotly
package, we have a different checklistbelow :-).
Documentation PR
doc/README.md
filedoc-prod
branch OR it targets themain
branchpx
example if at all possibleplotly.graph_objects as go
/plotly.express as px
/plotly.io as pio
df
fig = <something>
call is high up in each new/modified example (eitherpx.<something>
ormake_subplots
orgo.Figure
)fig.add_*
andfig.update_*
rather thango.Figure(data=..., layout=...)
in every new/modified examplefig.add_shape
andfig.update_xaxes
are used instead of bigfig.update_layout
calls in every new/modified examplefig.show()
is at the end of each new/modified exampleplotly.plot()
andplotly.iplot()
are not used in any new/modified exampleCode PR
plotly.graph_objects
, my modifications concern thecodegen
files and not generated files.modified existing tests.
new tutorial notebook (please see the doc checklist as well).
-->