-
Notifications
You must be signed in to change notification settings - Fork 1
[MRG] Bar chart notebook #1
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
Conversation
This PR is not completely ready for review yet, I need to add some text at the beginning of sections, but I wanted some advice whether the examples and the syntax used in examples look ok. |
Also, what are the available color names with plotly? (like red, blue, ...) Is it possible to have darkred, lightblue etc. ? I think most users can't be bothered with RGB or hex... |
As you see, I tried to avoid having dictionaries as much as possible, hence I made heavy use of the magic underscore. In particular, |
Question: when we call |
I think this one is ready for another pass. One question is where the px reference page will be. I left some TODOs for potential links, I think it's ok to merge keeping the TODOs and make another pass for removing the TODOs before the release. |
@nicolaskruchten and now with plenty of inlining and |
notebooks/bar-charts.md
Outdated
When data are not available as tidy dataframes, it is also possible to use the more generic `go.Bar` function from `plotly.graph_objs`. | ||
|
||
```python | ||
import plotly.graph_objs as go |
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 start using graph_objects
now!
notebooks/bar-charts.md
Outdated
go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29]) | ||
]) | ||
# Change the bar mode | ||
fig.update(layout_barmode='group') |
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.
this one will need fig.show()
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 should probably also consistently use .update_layout()
now that we have it
notebooks/bar-charts.md
Outdated
go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29]) | ||
]) | ||
# Change the bar mode | ||
fig.update(layout_barmode='stack') |
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.
fig.show()
notebooks/bar-charts.md
Outdated
fig = go.Figure(data=data, layout=layout) | ||
py.iplot(fig, filename='angled-text-bar') | ||
# Here we modify the tickangle of the xaxis, resulting in rotated labels. | ||
fig.update(layout_barmode='group', layout_xaxis_tickangle=-45) |
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.
.update_layout()
will make this a little bit shorter :)
notebooks/bar-charts.md
Outdated
|
||
fig = go.Figure(data=data, layout=layout) | ||
py.iplot(fig, filename='style-bar') | ||
fig.update(layout=layout) |
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.
This can be updated to .update_layout( ...contents of go.Layout ... )
so no need to actually create layout
or refer to go.Layout
at all I think.
notebooks/bar-charts.md
Outdated
fig = go.Figure(data=data, layout=layout) | ||
py.iplot(fig, filename='style-bar') | ||
fig.update(layout=layout) | ||
fig.show() | ||
``` | ||
|
||
### Waterfall Bar Chart |
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.
Yikes, let's remove this waterfall example altogether! we have a specific waterfall
trace now and should not be confusing users with this old thing :)
OK this one is super close! Just needs a couple of updates to track the latest integration build, but we can do that in a follow-up pass if you're sick of iterating on it...
Basically we don't need to use the generic |
Should be good to go! Yes, I don't think we need |
💃 to merge once the "waterfall" example has been removed, and all references to |
Refreshed the bar chart notebook, using px and a more modern plotly syntax.