Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd19b14

Browse files
Merge pull request #2908 from plotly/add-dash-snippets
Add 5 more Dash Snippets
2 parents 8e9c8a1 + 5518dc5 commit dd19b14

File tree

5 files changed

+80
-15
lines changed

5 files changed

+80
-15
lines changed

doc/python/histograms.md

Lines changed: 19 additions & 6 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.1
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: How to make Histograms in Python with Plotly.
2626
display_as: statistical
@@ -30,9 +30,9 @@ jupyter:
3030
order: 3
3131
page_type: example_index
3232
permalink: python/histograms/
33-
redirect_from:
34-
- /python/histogram-tutorial/
35-
- /python/histogram/
33+
redirect_from:
34+
- /python/histogram-tutorial/
35+
- /python/histogram/
3636
thumbnail: thumbnail/histogram.jpg
3737
---
3838

@@ -71,6 +71,19 @@ fig = px.histogram(df, x="total_bill", nbins=20)
7171
fig.show()
7272
```
7373

74+
#### Histograms in Dash
75+
76+
[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`.
77+
78+
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>.**
79+
80+
81+
```python hide_code=true
82+
from IPython.display import IFrame
83+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
84+
IFrame(snippet_url + 'histograms', width='100%', height=630)
85+
```
86+
7487
#### Accessing the counts (y-axis) values
7588

7689
JavaScript calculates the y-axis (count) values on the fly in the browser, so it's not accessible in the `fig`. You can manually calculate it using `np.histogram`.

doc/python/legend.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 configure and style the legend in Plotly with Python.
2626
display_as: file_settings
@@ -133,6 +133,19 @@ fig.update_layout(legend=dict(
133133
fig.show()
134134
```
135135

136+
#### Legends in Dash
137+
138+
[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`.
139+
140+
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>.**
141+
142+
143+
```python hide_code=true
144+
from IPython.display import IFrame
145+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
146+
IFrame(snippet_url + 'legend', width='100%', height=630)
147+
```
148+
136149
#### Horizontal Legends
137150

138151
The `layout.legend.orientation` attribute can be set to `"h"` for a horizontal legend. Here we also position it above the plotting area.

doc/python/subplots.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.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 make subplots in with Plotly's Python graphing library. Examples
2626
of stacked, custom-sized, gridded, and annotated subplots.
@@ -211,6 +211,19 @@ fig.add_trace(go.Scatter(x=[20, 30, 40], y=[50, 60, 70]),
211211
fig.show()
212212
```
213213

214+
#### Subplots in Dash
215+
216+
[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`.
217+
218+
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>.**
219+
220+
221+
```python hide_code=true
222+
from IPython.display import IFrame
223+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
224+
IFrame(snippet_url + 'subplots', width='100%', height=630)
225+
```
226+
214227
#### Customizing Subplot Axes
215228
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.
216229

@@ -588,4 +601,4 @@ All of the y-axis properties are found here: https://plotly.com/python/reference
588601
```python
589602
from plotly.subplots import make_subplots
590603
help(make_subplots)
591-
```
604+
```

doc/python/text-and-annotations.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 add text labels and annotations to plots in python.
2626
display_as: file_settings
@@ -103,6 +103,19 @@ fig.add_trace(go.Scatter(
103103
fig.show()
104104
```
105105

106+
### Text positioning in Dash
107+
108+
[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`.
109+
110+
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>.**
111+
112+
113+
```python hide_code=true
114+
from IPython.display import IFrame
115+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
116+
IFrame(snippet_url + 'text-and-annotations', width='100%', height=630)
117+
```
118+
106119
### Controlling text fontsize with uniformtext
107120

108121
For the [pie](/python/pie-charts), [bar](/python/bar-charts), [sunburst](/python/sunburst-charts) and [treemap](/python/treemap-charts) traces, it is possible to force all the text labels to have the same size thanks to the `uniformtext` layout parameter. The `minsize` attribute sets the font size, and the `mode` attribute sets what happens for labels which cannot fit with the desired fontsize: either `hide` them or `show` them with overflow.

doc/python/time-series.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 plot date and time in python.
2626
display_as: financial
@@ -61,6 +61,19 @@ fig = go.Figure([go.Scatter(x=df['Date'], y=df['AAPL.High'])])
6161
fig.show()
6262
```
6363

64+
### Time Series in Dash
65+
66+
[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`.
67+
68+
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>.**
69+
70+
71+
```python hide_code=true
72+
from IPython.display import IFrame
73+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
74+
IFrame(snippet_url + 'time-series', width='100%', height=630)
75+
```
76+
6477
### Different Chart Types on Date Axes
6578

6679
Any kind of cartesian chart can be placed on `date` axes, for example this bar chart of relative stock ticker values.

0 commit comments

Comments
 (0)