-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Updates to examples in fundamentals section #2201
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
doc/python/renderers.md
Outdated
|
||
Instead, pass your figure as the `figure` parameter to the `dcc.Graph` component. | ||
|
||
```python |
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.
does this actually work here? I would think you'd need to escape this block somehow so it doesn't actually execute :)
doc/python/subplots.md
Outdated
|
||
Here is an example of creating a figure with two scatter traces in side-by-side subplots. | ||
This function accepts two integer parameters (`rows` and `cols`), which specifiy how the subplots should be laid out. |
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 is probably misleading, as this function accepts many other parameters as well...
doc/python/subplots.md
Outdated
@@ -203,9 +205,9 @@ fig.show() | |||
``` | |||
|
|||
#### Customizing Subplot Axes | |||
After a figure with subplots is created using the `make_subplots` function, its axis properties (title, font, range, grid style, etc.) can be customized using the `update_xaxes` and `update_yaxes` graph object figure methods. By default, these methods apply to all of the x axes or y axes in the figure. The `row` and `col` arguments can be used to control which axes are targeted by the update. | |||
After a figure with subplots is created using the `make_subplots()` function, its axis properties (title, font, range, grid style, etc.) can be customized using the `update_xaxes` and `update_yaxes` graph object figure methods. By default, these methods apply to all of the `x` axes or `y` axes in the figure. The `row` and `col` arguments can be used to control which axes are targeted by the update. |
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.
why put x
and y
in backticks here?
doc/python/subplots.md
Outdated
@@ -354,7 +355,7 @@ fig.show() | |||
``` | |||
|
|||
#### Subplots Types | |||
By default, the `make_subplots` function assumes that the traces that will be added to all subplots are 2-dimensional cartesian traces (e.g. `scatter`, `bar`, `histogram`, `violin`, etc.). Traces with other subplot types (e.g. `scatterpolar`, `scattergeo`, `parcoords`, etc.) are supporteed by specifying the `type` subplot option in the `specs` argument to `make_subplots`. | |||
By default, the `make_subplots()` function assumes that the traces that will be added to all subplots are 2-dimensional cartesian traces (e.g. `scatter`, `bar`, `histogram`, `violin`, etc.). Traces with other subplot types (e.g. `scatterpolar`, `scattergeo`, `parcoords`, etc.) are supporteed by specifying the `type` subplot option in the `specs` argument to `make_subplots`. |
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.
in general, I don't really agree with putting the ()
after the function name everywhere (this comment applies to this whole PR btw). The function is properly named make_subplots
and calling it with no parameters like make_subplots()
will probably result in an error. It's probably OK to use this for something like "the .show()
method" as that actually will work with no arguments.
Also note: maybe we haven't used it super consistently, but the leading .
in "the .show()
method" is actually informative IMO in that it reminds the reader that show
isn't a free function but a method of a figure. As a matter of style we could say "the fig.show
method" or "the .show
method of every go.Figure
object" or something.
In any case, unless you're going to fully standardize the usage of this kind of thing throughout the docs, I find it pretty distracting and hard to review changes like this :)
doc/python/renderers.md
Outdated
@@ -171,18 +175,17 @@ fig.show(renderer="png") | |||
``` | |||
|
|||
###### `pdf` | |||
This renderer displays figures as static PDF files. This is especially useful for notebooks that will be exported to PDF files using the LaTeX export capabilities of nbconvert. | |||
This renderer displays figures as static `.pdf` files. This is especially useful for notebooks that will be exported to `.pdf` files using the `LaTeX` export capabilities of `nbconvert`. |
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.
here the usage of backticks is questionable also... "static PDF files" is acceptable, no? It's not clear why "static .pdf
files" is clearer or better :)
doc/python/renderers.md
Outdated
|
||
> Note: Adding the Plotly.js bundle to the notebook does add a few megabytes to the notebook size, so if you can count on having an internet connection you may want to consider the `notebook_connected` renderer. | ||
> Note: Adding the `plotly.js` bundle to the notebook adds a few megabytes to the notebook size. If you can count on always having an Internet connection, you may want to consider using the `notebook_connected` renderer if notebook size is a constraint. |
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 don't think we should backtick "plotly.js" ...
doc/python/renderers.md
Outdated
3. Using a `FigureWidget` in an ipywidgets context | ||
In general, there are three different approaches you can take in order to display figures: | ||
|
||
1. Using the `renderers` framework in the context of a script or notebook |
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.
Here also I think the usage of backticks for renderers
is going a bit too far IMO...
|
||
`go` figures also support `update_layout_images` in order to [update background layout images](/python/images/), `update_annotations` in order to [update annotations](/python/text-and-annotations/#multiple-annotations), and `update-shapes` in order to [update shapes](/python/shapes/). | ||
Figures created with the `plotly.graph_objects` module also support: |
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 isn't totally correct: all figures support this, including those created with make_subplots and PX...
As a general comment, I think the style rule around backticks could be something like "text that might reasonably end up being executed gets backticks"... this excludes |
@nicolaskruchten I agree with your style comments and think this is a good opportunity to standardize. To summarize, if a piece of text is likely to be copied into a development environment, it should be styled with backticks. So variable names like File formats such as PDF and JPEG should not be in backticks. What about package and library names like |
@nicolaskruchten Can you please take another look at this. |
doc/requirements.txt
Outdated
@@ -23,5 +23,4 @@ recommonmark | |||
pathlib | |||
python-frontmatter | |||
datashader | |||
pyarrow | |||
cufflinks==0.17.3 | |||
pyarrow |
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 diff should not be in this PR: we need cufflinks installed
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'll make the change and merge this
c03bea8
to
9801eea
Compare
The purpose of this PR is to update 3 of our examples.