Skip to content

Commit 8e9c8a1

Browse files
Merge pull request #2898 from plotly/dash-snippets
Add 5 more Dash Snippets
2 parents 44f0032 + fe55257 commit 8e9c8a1

File tree

5 files changed

+89
-15
lines changed

5 files changed

+89
-15
lines changed

doc/python/colorscales.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.3.1
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.6.8
23+
version: 3.7.6
2424
plotly:
2525
description: How to set, create and control continous color scales and color bars
2626
in scatter, bar, map and heatmap figures.
@@ -90,6 +90,19 @@ fig = px.scatter(df, x="total_bill", y="tip", color="size",
9090
fig.show()
9191
```
9292

93+
### Colorscales in Dash
94+
95+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
96+
97+
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a style="color:red;" href="https://plotly.com/dash/">Dash Enterprise</a>.**
98+
99+
100+
```python hide_code=true
101+
from IPython.display import IFrame
102+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
103+
IFrame(snippet_url + 'colorscales', width='100%', height=630)
104+
```
105+
93106
### Color Scales in Plotly Express
94107

95108
By default, [Plotly Express](/python/plotly-express/) will use the color scale from the active [template](/python/templates/)'s `layout.colorscales.sequential` attribute, and the default active template is `plotly` which uses the `Plasma` color scale. You can choose any of the [built-in color scales](/python/builtin-colorscales/), however, or define your own.
@@ -557,4 +570,4 @@ fig.show()
557570

558571
### Reference
559572

560-
See https://plotly.com/python/reference/ for more information and chart attribute options!
573+
See https://plotly.com/python/reference/ for more information and chart attribute options!

doc/python/marker-style.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.4.2
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.7
23+
version: 3.7.6
2424
plotly:
2525
description: How to style markers in Python with Plotly.
2626
display_as: file_settings
@@ -107,6 +107,19 @@ fig.show()
107107

108108
Fully opaque, the default setting, is useful for non-overlapping markers. When many points overlap it can be hard to observe density.
109109

110+
111+
### Control Marker Border with Dash
112+
113+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
114+
115+
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a style="color:red;" href="https://plotly.com/dash/">Dash Enterprise</a>.**
116+
117+
```python hide_code=true
118+
from IPython.display import IFrame
119+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
120+
IFrame(snippet_url + 'marker-style', width='100%', height=630)
121+
```
122+
110123
### Opacity
111124

112125
Setting opacity outside the marker will set the opacity of the trace. Thus, it will allow greater visbility of additional traces but like fully opaque it is hard to distinguish density.

doc/python/setting-graph-size.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.3.2
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.7.6
2424
plotly:
2525
description: How to manipulate the graph size, margins and background color.
2626
display_as: file_settings
@@ -51,6 +51,18 @@ fig.update_layout(
5151
fig.show()
5252
```
5353

54+
### Adjusting graph size with Dash
55+
56+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
57+
58+
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a style="color:red;" href="https://plotly.com/dash/">Dash Enterprise</a>.**
59+
60+
```python hide_code=true
61+
from IPython.display import IFrame
62+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
63+
IFrame(snippet_url + 'setting-graph-size', width='100%', height=630)
64+
```
65+
5466
### Adjusting Height, Width, & Margins With Graph Objects
5567

5668
[Graph objects](/python/graph-objects/) are the low-level building blocks of figures which you can use instead of Plotly Express for greater control.
@@ -117,4 +129,4 @@ fig.show()
117129

118130
#### Reference
119131

120-
See https://plotly.com/python/reference/layout/ for more information and chart attribute options!
132+
See https://plotly.com/python/reference/layout/ for more information and chart attribute options!

doc/python/static-image-export.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.6
8+
format_version: '1.2'
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.7.6
2424
plotly:
2525
description: Plotly allows you to save static images of your plots. Save the image
2626
to your local computer, or embed it inside your Jupyter notebooks as a static
@@ -148,6 +148,20 @@ fig.write_image("images/fig1.eps")
148148

149149
**Note:** It is important to note that any figures containing WebGL traces (i.e. of type `scattergl`, `heatmapgl`, `contourgl`, `scatter3d`, `surface`, `mesh3d`, `scatterpolargl`, `cone`, `streamtube`, `splom`, or `parcoords`) that are exported in a vector format will include encapsulated rasters, instead of vectors, for some parts of the image.
150150

151+
152+
### Image Export in Dash
153+
154+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
155+
156+
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a style="color:red;" href="https://plotly.com/dash/">Dash Enterprise</a>.**
157+
158+
159+
```python hide_code=true
160+
from IPython.display import IFrame
161+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
162+
IFrame(snippet_url + 'static-image-export', width='100%', height=630)
163+
```
164+
151165
### Get Image as Bytes
152166

153167
The `plotly.io.to_image` function is used to return an image as a bytes object. You can also use the `.to_image` graph object figure method.
@@ -221,4 +235,4 @@ Here is a complete listing of the available image export settings:
221235
See the [Orca Management](/python/orca-management/) section for information on how to specify image export settings when using orca.
222236

223237
### Summary
224-
In summary, to export high-quality static images from plotly.py, all you need to do is install the `kaleido` package and then use the `plotly.io.write_image` and `plotly.io.to_image` functions (or the `.write_image` and `.to_image` graph object figure methods).
238+
In summary, to export high-quality static images from plotly.py, all you need to do is install the `kaleido` package and then use the `plotly.io.write_image` and `plotly.io.to_image` functions (or the `.write_image` and `.to_image` graph object figure methods).

doc/python/table.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.1
8+
format_version: '1.2'
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
1313
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.7.6
1424
plotly:
1525
description: How to make tables in Python with Plotly.
1626
display_as: basic
@@ -80,6 +90,18 @@ fig = go.Figure(data=[go.Table(
8090
fig.show()
8191
```
8292

93+
#### Tables in Dash
94+
95+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
96+
97+
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a style="color:red;" href="https://plotly.com/dash/">Dash Enterprise</a>.**
98+
99+
```python hide_code=true
100+
from IPython.display import IFrame
101+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
102+
IFrame(snippet_url + 'table', width='100%', height=630)
103+
```
104+
83105
#### Changing Row and Column Size
84106

85107
```python
@@ -211,4 +233,4 @@ fig.show()
211233
```
212234

213235
#### Reference
214-
For more information on tables and table attributes see: https://plotly.com/python/reference/table/.
236+
For more information on tables and table attributes see: https://plotly.com/python/reference/table/.

0 commit comments

Comments
 (0)