Skip to content
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
24 changes: 3 additions & 21 deletions doc/python/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,27 +339,6 @@ sliders_dict = {
"steps": []
}

# make data
year = 1952
for continent in continents:
dataset_by_year = dataset[dataset["year"] == year]
dataset_by_year_and_cont = dataset_by_year[
dataset_by_year["continent"] == continent]

data_dict = {
"x": list(dataset_by_year_and_cont["lifeExp"]),
"y": list(dataset_by_year_and_cont["gdpPercap"]),
"mode": "markers",
"text": list(dataset_by_year_and_cont["country"]),
"marker": {
"sizemode": "area",
"sizeref": 200000,
"size": list(dataset_by_year_and_cont["pop"])
},
"name": continent
}
fig_dict["data"].append(data_dict)

# make frames
for year in years:
frame = {"data": [], "name": str(year)}
Expand Down Expand Up @@ -396,6 +375,9 @@ for year in years:

fig_dict["layout"]["sliders"] = [sliders_dict]

# make data
fig_dict["data"] = fig_dict["frames"][0]['data']

fig = go.Figure(fig_dict)

fig.show()
Expand Down
4 changes: 2 additions & 2 deletions doc/python/choropleth-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ In **Plotly.py 6.3 and later**, the built-in countries geometry is created from

In **earlier versions of Plotly.py**, the built-in countries geometry is based on Natural Earth data only. Plotly includes data from Natural Earth "as-is". This dataset draws boundaries of countries according to de facto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).

To use the built-in countries geometry, provide `locations` as [three-letter ISO country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3).
To use the built-in countries geometry, provide `locations` as [three-letter ISO country codes](/python/outline-map-locations/#supported-iso-codes).

```python
import plotly.express as px
Expand All @@ -229,7 +229,7 @@ fig = px.choropleth(df, locations="iso_alpha",
fig.show()
```

To use the USA States geometry, set `locationmode='USA-states'` and provide `locations` as two-letter state abbreviations:
To use the USA States geometry, set `locationmode='USA-states'` and provide `locations` as [two-letter state abbreviations](/python/outline-map-locations/#supported-us-state-codes):

```python
import plotly.express as px
Expand Down
13 changes: 6 additions & 7 deletions doc/python/dendrogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fig.show()

#### Plot a Dendrogram with a Heatmap

See also the [Dash Bio demo](https://dash-bio.plotly.host/dash-clustergram/).
This example uses randomly generated sample data to demonstrate how to plot a dendrogram with a heatmap.

```python
import plotly.graph_objects as go
Expand All @@ -89,12 +89,11 @@ import numpy as np
from scipy.spatial.distance import pdist, squareform


# get data
data = np.genfromtxt("http://files.figshare.com/2133304/ExpRawData_E_TABM_84_A_AFFY_44.tab",
names=True,usecols=tuple(range(1,30)),dtype=float, delimiter="\t")
data_array = data.view((float, len(data.dtype.names)))
data_array = data_array.transpose()
labels = data.dtype.names
# Generate sample data
np.random.seed(1)
X = np.random.rand(15, 15)
labels = [f'Sample_{i}' for i in range(15)]
data_array = X

# Initialize figure by creating upper dendrogram
fig = ff.create_dendrogram(data_array, orientation='bottom', labels=labels)
Expand Down
Loading