Skip to content

Commit 55da3b6

Browse files
author
Joseph Damiba
committed
fixups
1 parent 8df59bd commit 55da3b6

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

binder/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ networkx
1414
scikit-image
1515
datashader
1616
pyarrow
17-
dash_core_components
17+
cufflinks==0.17.3

doc/python/creating-and-updating-figures.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ jupyter:
3939

4040
### Representing Figures
4141

42-
The goal of the `plotly.py` package is to provide a pleasant Python interface for creating figure specifications which are displayed by the [`plotly.js`](https://plot.ly/javascript) JavaScript graphing library.
42+
The goal of the plotly.py package is to provide a pleasant Python interface for creating figure specifications which are displayed by the [plotly.js](https://plot.ly/javascript) JavaScript graphing library.
4343

44-
In the context of the `plotly.js` library, a figure is specified by a declarative [JSON](https://www.json.org/json-en.html) data structure.
44+
In the context of the plotly.js library, a figure is specified by a declarative [JSON](https://www.json.org/json-en.html) data structure.
4545

46-
Therefore, you should always keep in mind as you are creating and updating figures using the `plotly.py` package that its ultimate goal is to help users produce Python [dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) that can be automatically [serialized](https://en.wikipedia.org/wiki/Serialization) into the JSON data structure that the `plotly.js` graphing library understands.
46+
Therefore, you should always keep in mind as you are creating and updating figures using the plotly.py package that its ultimate goal is to help users produce Python [dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) that can be automatically [serialized](https://en.wikipedia.org/wiki/Serialization) into the JSON data structure that the plotly.js graphing library understands.
4747

4848
#### Figures As Dictionaries
4949

@@ -612,7 +612,7 @@ There are also `for_each_xaxis()` and `for_each_yaxis()` methods that are analog
612612

613613
### Other Update Methods
614614

615-
Figures created with the `plotly.graph_objects` module also support:
615+
Figures created with the plotly.py graphing library also support:
616616
- the `update_layout_images()` method in order to [update background layout images](/python/images/),
617617
- `update_annotations()` in order to [update annotations](/python/text-and-annotations/#multiple-annotations),
618618
- and `update-shapes()` in order to [update shapes](/python/shapes/).

doc/python/renderers.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Plotly's Python graphing library, `plotly.py`, gives you a wide range of options
4040

4141
In general, there are three different approaches you can take in order to display figures:
4242

43-
1. Using the `renderers` framework in the context of a script or notebook
43+
1. Using the renderers framework in the context of a script or notebook
4444
2. Using [Dash](https://dash.plot.ly) in a web app context
4545
3. Using a `FigureWidget` in an `ipywidgets` context
4646

4747
Each of these approaches is discussed below.
4848

49-
### Displaying Figures Using The `renderers` Framework
49+
### Displaying Figures Using The renderers Framework
5050

51-
The `renderers` framework is a flexible approach for displaying `plotly.py` figures in a variety of contexts. To display a figure using the `renderers` framework, you call the `show()` method on a graph object figure, or pass the figure to the `plotly.io.show` function. With either approach, `plotly.py` will display the figure using the current default renderer(s).
51+
The renderers framework is a flexible approach for displaying `plotly.py` figures in a variety of contexts. To display a figure using the renderers framework, you call the `.show()` method on a graph object figure, or pass the figure to the `plotly.io.show` function. With either approach, `plotly.py` will display the figure using the current default renderer(s).
5252

5353
```python
5454
import plotly.graph_objects as go
@@ -59,7 +59,7 @@ fig = go.Figure(
5959
fig.show()
6060
```
6161

62-
In most situations, you can omit the call to `show()` and allow the figure to display itself.
62+
In most situations, you can omit the call to `.show()` and allow the figure to display itself.
6363

6464
```python
6565
import plotly.graph_objects as go
@@ -115,17 +115,17 @@ fig.show(renderer="svg")
115115
In this section, we will describe the built-in renderers so that you can choose the one(s) that best suit your needs.
116116

117117
##### Interactive Renderers
118-
Interactive renderers display figures using the Plotly.js JavaScript library and are fully interactive, supporting pan, zoom, hover tooltips, etc.
118+
Interactive renderers display figures using the plotly.js JavaScript library and are fully interactive, supporting pan, zoom, hover tooltips, etc.
119119

120120
###### `notebook`
121-
This renderer is intended for use in the classic [Jupyter Notebook](https://jupyter.org/install.html) (not JupyterLab). The full `plotly.js` JavaScript library bundle is added to the notebook the first time a figure is rendered, so this renderer will work without an Internet connection.
121+
This renderer is intended for use in the classic [Jupyter Notebook](https://jupyter.org/install.html) (not JupyterLab). The full plotly.js JavaScript library bundle is added to the notebook the first time a figure is rendered, so this renderer will work without an Internet connection.
122122

123123
This renderer is a good choice for notebooks that will be exported to HTML files (Either using [nbconvert](https://nbconvert.readthedocs.io/en/latest/) or the "Download as HTML" menu action) because the exported HTML files will work without an Internet connection.
124124

125-
> 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.
125+
> 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.
126126
127127
###### `notebook_connected`
128-
This renderer is the same as `notebook` renderer, except the `plotly.js` JavaScript library bundle is loaded from an online CDN location. This saves a few megabytes in notebook size, but an Internet connection is required in order to display figures that are rendered this way.
128+
This renderer is the same as `notebook` renderer, except the plotly.js JavaScript library bundle is loaded from an online CDN location. This saves a few megabytes in notebook size, but an Internet connection is required in order to display figures that are rendered this way.
129129

130130
This renderer is a good choice for notebooks that will be shared with [nbviewer](https://nbviewer.jupyter.org/) since users must have an active Internet connection to access nbviewer in the first place.
131131

@@ -146,7 +146,7 @@ This renderer will open a figure in a browser tab using the default web browser.
146146
These renderers are the same as the `browser` renderer, but they force the use of a particular browser.
147147

148148
###### `iframe` and `iframe_connected`
149-
These renderers write figures out as standalone HTML files and then display [`iframe`](https://www.w3schools.com/html/html_iframe.asp) elements that reference these HTML files. The `iframe` renderer will include the `plotly.js` JavaScript bundle in each HTML file that is written, while the `iframe_connected` renderer includes only a reference to an online CDN location from which to load `plotly.js`. Consequently, the `iframe_connected` renderer outputs files that are smaller than the `iframe` renderer, but it requires an Internet connection while the `iframe` renderer can operate offline.
149+
These renderers write figures out as standalone HTML files and then display [`iframe`](https://www.w3schools.com/html/html_iframe.asp) elements that reference these HTML files. The `iframe` renderer will include the plotly.js JavaScript bundle in each HTML file that is written, while the `iframe_connected` renderer includes only a reference to an online CDN location from which to load plotly.js. Consequently, the `iframe_connected` renderer outputs files that are smaller than the `iframe` renderer, but it requires an Internet connection while the `iframe` renderer can operate offline.
150150

151151
This renderer may be useful when working with notebooks than contain lots of large figures. When using the `notebook` or `notebook_connected` renderer, all of the data for all of the figures in a notebook are stored inline in the notebook itself. If this would result in a prohibitively large notebook size, an `iframe` or `iframe_connected` renderer could be used instead. With the `iframe` renderers, the figure data are stored in the individual HTML files rather than in the notebook itself, resulting in a smaller notebook size.
152152

@@ -175,16 +175,16 @@ fig = go.Figure(
175175
fig.show(renderer="png")
176176
```
177177

178-
###### `pdf`
179-
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`.
178+
###### PDF
179+
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`](https://nbconvert.readthedocs.io/en/latest/).
180180

181181
##### Other Miscellaneous Renderers
182182

183-
###### `json`
183+
###### JSON
184184
In editors that support it (JupyterLab, nteract, and the Visual Studio Code notebook interface), this renderer displays the JSON representation of a figure in a collapsible interactive tree structure. This can be very useful for examining the structure of complex figures.
185185

186186
##### Multiple Renderers
187-
You can specify that multiple renderers should be used by joining their names on `"+"` characters. This is useful when writing code that needs to support multiple contexts. For example, if a notebook specifies a default renderer string of `"notebook+plotly_mimetype+pdf"`then this notebook would be able to run in the classic Jupyter Notebook, in JupyterLab, and it would support being exported to `.pdf` using `nbconvert`.
187+
You can specify that multiple renderers should be used by joining their names on `"+"` characters. This is useful when writing code that needs to support multiple contexts. For example, if a notebook specifies a default renderer string of `"notebook+plotly_mimetype+pdf"`then this notebook would be able to run in the classic Jupyter Notebook, in JupyterLab, and it would support being exported to PDF using `nbconvert`.
188188

189189
#### Customizing Built-In Renderers
190190
Most built-in renderers have configuration options to customize their behavior. To view a description of a renderer, including its configuration options, access the renderer object using dictionary-style key lookup on the `plotly.io.renderers` configuration object and then display it. Here is an example of accessing and displaying the `png` renderer.
@@ -228,13 +228,15 @@ fig.show(renderer="png", width=800, height=300)
228228
```
229229

230230
### Displaying Figures Using Dash
231+
231232
[Dash](https://dash.plot.ly) is a Python framework for building web applications, and it provides built-in support for displaying figures created with Plotly's graphing libraries. See the [Dash User Guide](https://dash.plot.ly/) for more information.
232233

233-
It is important to note that Dash does not use the renderers framework discussed above, so you should not use the `show()` figure method or the `plotly.io.show` function inside Dash applications.
234+
It is important to note that Dash does not use the renderers framework discussed above, so you should not try to use the `.show()` figure method or the `plotly.io.show` function to render figures inside Dash applications.
234235

235-
Instead, pass your figure as the `figure` parameter to the `dcc.Graph` component.
236+
Instead, pass your figure as the `figure` parameter to the [`dcc.Graph`](https://dash.plot.ly/dash-core-components/graph) component, which is part of the [Dash Core Components](https://dash.plot.ly/dash-core-components) library. The code below demonstrates how to do this.
236237

237-
```python
238+
239+
```python .noeval
238240
import dash_core_components as dcc
239241
import plotly.graph_objs as go
240242

@@ -246,6 +248,7 @@ dcc.Graph(
246248
)
247249
```
248250

251+
249252
## Displaying Figures Using `ipywidgets`
250253
Plotly figures can be displayed in [ipywidgets](https://ipywidgets.readthedocs.io/en/stable/) contexts using `plotly.graph_objects.FigureWidget` objects. `FigureWidget` is a figure graph object (just like `plotly.graph_objects.Figure`), so you can add traces to it and update it just like a regular `Figure`. But `FigureWidget` is also an `ipywidgets` object, which means that you can display it alongside other `ipywidgets` to build user interfaces right in the notebook.
251254

doc/python/subplots.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ jupyter:
3737

3838
#### Simple Subplot
3939

40-
Figures with subplots are created using the `make_subplots()` function from the `plotly.subplots` module.
41-
42-
This function accepts two integer parameters (`rows` and `cols`), which specifiy how the subplots should be laid out.
40+
Figures with subplots are created using the `make_subplots` function from the `plotly.subplots` module.
4341

4442
Here is an example of creating a figure that includes two `scatter` traces which are side-by-side since there are 2 columns and 1 row in the subplot layout.
4543

@@ -185,7 +183,7 @@ fig.show()
185183
```
186184

187185
#### Customize Subplot Column Widths and Row Heights
188-
The `column_widths` argument to `make_subplots()` can be used to customize the relative widths of the columns in a subplot grid. It should be set to a list of numbers with a length that matches the `cols` argument. These number will be normalized, so that they sum to 1, and used to compute the relative widths of the subplot grid columns. The `row_heights` argument serves the same purpose for controlling the relative heights of rows in the subplot grid.
186+
The `column_widths` argument to `make_subplots` can be used to customize the relative widths of the columns in a subplot grid. It should be set to a list of numbers with a length that matches the `cols` argument. These number will be normalized, so that they sum to 1, and used to compute the relative widths of the subplot grid columns. The `row_heights` argument serves the same purpose for controlling the relative heights of rows in the subplot grid.
189187

190188
Here is an example of creating a figure with two scatter traces in side-by-side subplots. The left subplot is set to be wider than the right one.
191189

@@ -205,9 +203,9 @@ fig.show()
205203
```
206204

207205
#### Customizing Subplot Axes
208-
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.
206+
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.
209207

210-
Here is an example that creates a figure with a 2 x 2 subplot grid, populates each subplot with a scatter trace, and then updates the `x` and `y` axis titles for each subplot individually.
208+
Here is an example that creates a figure with a 2 x 2 subplot grid, populates each subplot with a scatter trace, and then updates the x and y axis titles for each subplot individually.
211209

212210
```python
213211
from plotly.subplots import make_subplots
@@ -243,9 +241,9 @@ fig.show()
243241
```
244242

245243
#### Subplots with Shared X-Axes
246-
The `shared_xaxes` argument to `make_subplots()` can be used to link the x axes of subplots in the resulting figure. The `vertical_spacing` argument is used to control the vertical spacing between rows in the subplot grid.
244+
The `shared_xaxes` argument to `make_subplots` can be used to link the x axes of subplots in the resulting figure. The `vertical_spacing` argument is used to control the vertical spacing between rows in the subplot grid.
247245

248-
Here is an example that creates a figure with 3 vertically stacked subplots with linked `x` axes. A small vertical spacing value is used to reduce the spacing between subplot rows.
246+
Here is an example that creates a figure with 3 vertically stacked subplots with linked x axes. A small vertical spacing value is used to reduce the spacing between subplot rows.
249247

250248
```python
251249
from plotly.subplots import make_subplots
@@ -270,9 +268,9 @@ fig.show()
270268
```
271269

272270
#### Subplots with Shared Y-Axes
273-
The `shared_yaxes` argument to `make_subplots()` can be used to link the `y` axes of subplots in the resulting figure.
271+
The `shared_yaxes` argument to `make_subplots` can be used to link the y axes of subplots in the resulting figure.
274272

275-
Here is an example that creates a figure with a 2 x 2 subplot grid, where the `y` axes of each row are linked.
273+
Here is an example that creates a figure with a 2 x 2 subplot grid, where the y axes of each row are linked.
276274

277275

278276
```python
@@ -321,7 +319,7 @@ fig.show()
321319
```
322320

323321
#### Custom Sized Subplot with Subplot Titles
324-
The `specs` argument to `make_subplots()` is used to configure per-subplot options. `specs` must be a 2-dimension list with dimensions that match those provided as the `rows` and `cols` arguments. The elements of `specs` may either be `None`, indicating no subplot should be initialized starting with this grid cell, or a dictionary containing subplot options. The `colspan` subplot option specifies the number of grid columns that the subplot starting in the given cell should occupy. If unspecified, `colspan` defaults to 1.
322+
The `specs` argument to `make_subplots` is used to configure per-subplot options. `specs` must be a 2-dimension list with dimensions that match those provided as the `rows` and `cols` arguments. The elements of `specs` may either be `None`, indicating no subplot should be initialized starting with this grid cell, or a dictionary containing subplot options. The `colspan` subplot option specifies the number of grid columns that the subplot starting in the given cell should occupy. If unspecified, `colspan` defaults to 1.
325323

326324
Here is an example that creates a 2 by 2 subplot grid containing 3 subplots. The subplot `specs` element for position (2, 1) has a `colspan` value of 2, causing it to span the full figure width. The subplot `specs` element for position (2, 2) is `None` because no subplot begins at this location in the grid.
327325

@@ -348,7 +346,7 @@ fig.show()
348346
```
349347

350348
#### Multiple Custom Sized Subplots
351-
If the `print_grid` argument to `make_subplots()` is set to `True`, then a text representation of the subplot grid will be printed.
349+
If the `print_grid` argument to `make_subplots` is set to `True`, then a text representation of the subplot grid will be printed.
352350

353351
Here is an example that uses the `rowspan` and `colspan` subplot options to create a custom subplot layout with subplots of mixed sizes. The `print_grid` argument is set to `True` so that the subplot grid is printed to the screen.
354352

@@ -377,7 +375,7 @@ fig.show()
377375
```
378376

379377
#### Subplots Types
380-
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`.
378+
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`.
381379

382380
Here are the possible values for the `type` option:
383381

doc/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ recommonmark
2323
pathlib
2424
python-frontmatter
2525
datashader
26-
pyarrow
27-
dash_core_components
26+
pyarrow

0 commit comments

Comments
 (0)