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

Skip to content

5 new dash snippets #2919

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

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions doc/python/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: "1.1"
jupytext_version: 1.1.6
format_version: '1.2'
jupytext_version: 1.6.0
kernelspec:
display_name: Python 3
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.7.6
plotly:
description: An introduction to creating animations with Plotly in Python.
display_as: animations
Expand All @@ -37,6 +47,19 @@ px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_gro
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
```

#### Animated figures in Dash

[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`.

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>.**


```python hide_code=true
from IPython.display import IFrame
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
IFrame(snippet_url + 'animations', width='100%', height=630)
```

#### Animated Bar Charts with Plotly Express

Note that you should always fix the `y_range` to ensure that your data remains visible throughout the animation.
Expand Down
21 changes: 17 additions & 4 deletions doc/python/candlestick-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.1.1
format_version: '1.2'
jupytext_version: 1.6.0
kernelspec:
display_name: Python 3
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.7
version: 3.7.6
plotly:
description: How to make interactive candlestick charts in Python with Plotly.
Six examples of candlestick charts with Pandas, time series, and yahoo finance
Expand Down Expand Up @@ -74,6 +74,19 @@ fig.update_layout(xaxis_rangeslider_visible=False)
fig.show()
```

#### Candlestick in Dash

[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`.

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>.**


```python hide_code=true
from IPython.display import IFrame
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
IFrame(snippet_url + 'candlestick-charts', width='100%', height=630)
```

#### Adding Customized Text and Annotations

```python
Expand Down Expand Up @@ -144,4 +157,4 @@ fig.show()
```

#### Reference
For more information on candlestick attributes, see: https://plotly.com/python/reference/candlestick/
For more information on candlestick attributes, see: https://plotly.com/python/reference/candlestick/
17 changes: 15 additions & 2 deletions doc/python/figure-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.4.2
jupytext_version: 1.6.0
kernelspec:
display_name: Python 3
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.7.7
version: 3.7.6
plotly:
description: The structure of a figure - data, traces and layout explained.
display_as: file_settings
Expand Down Expand Up @@ -49,6 +49,19 @@ print(fig)
fig.show()
```

### Accessing figure structures in Dash

[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`.

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>.**


```python hide_code=true
from IPython.display import IFrame
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
IFrame(snippet_url + 'figure-structure', width='100%', height=630)
```

### Figures as Trees of Attributes

Plotly.js supports inputs adhering to a well-defined schema, whose overall architecture is explained in this page and which is exhaustively documented in the [Figure Reference](/python/reference/index/) (which is itself generated from a [machine-readable JSON representation of the schema](https://raw.githubusercontent.com/plotly/plotly.js/master/dist/plot-schema.json)). Figures are represented as trees with named nodes called "attributes". The root node of the tree has three top-level attributes: `data`, `layout` and `frames` (see below).
Expand Down
19 changes: 16 additions & 3 deletions doc/python/plot-data-from-csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: "1.1"
jupytext_version: 1.2.0
format_version: '1.2'
jupytext_version: 1.6.0
kernelspec:
display_name: Python 3
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.8
version: 3.7.6
plotly:
description: How to create charts from csv files with Plotly and Python
display_as: advanced_opt
Expand Down Expand Up @@ -56,6 +56,19 @@ fig = px.line(df, x = 'AAPL_x', y = 'AAPL_y', title='Apple Share Prices over tim
fig.show()
```

### Plot from CSV in Dash

[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`.

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>.**


```python hide_code=true
from IPython.display import IFrame
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
IFrame(snippet_url + 'plot-data-from-csv', width='100%', height=630)
```

### Plot from CSV with `graph_objects`

```python
Expand Down
17 changes: 15 additions & 2 deletions doc/python/sankey-diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.1
jupytext_version: 1.6.0
kernel_info:
name: python2
kernelspec:
Expand All @@ -22,7 +22,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.8
version: 3.7.6
plotly:
description: How to make Sankey Diagrams in Python with Plotly.
display_as: basic
Expand Down Expand Up @@ -104,6 +104,19 @@ fig.update_layout(title_text="Energy forecast for 2050<br>Source: Department of
fig.show()
```

### Sankey Diagram in Dash

[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`.

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>.**


```python hide_code=true
from IPython.display import IFrame
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
IFrame(snippet_url + 'sankey-diagram', width='100%', height=630)
```

### Style Sankey Diagram
This example also uses [hovermode](https://plotly.com/python/reference/layout/#layout-hovermode) to enable multiple tooltips.

Expand Down