You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: How to make bubble charts in Python with Plotly.
15
26
display_as: basic
@@ -26,46 +37,28 @@ jupyter:
26
37
title: Bubble Charts | plotly
27
38
---
28
39
29
-
#### New to Plotly?
30
-
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).
31
-
<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).
32
-
<br>We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!
33
-
#### Version Check
34
-
Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version.
35
-
36
-
```python
37
-
import plotly
38
-
plotly.__version__
39
-
```
40
-
41
40
### Simple Bubble Chart
42
41
43
42
```python
44
-
import plotly.plotly as py
45
43
import plotly.graph_objs as go
46
44
47
45
trace0 = go.Scatter(
48
-
x=[1, 2, 3, 4],
49
-
y=[10, 11, 12, 13],
46
+
x=[1, 2, 3, 4], y=[10, 11, 12, 13],
50
47
mode='markers',
51
-
marker=dict(
52
-
size=[40, 60, 80, 100],
53
-
)
48
+
marker_size=[40, 60, 80, 100]
54
49
)
55
50
56
-
data= [trace0]
57
-
py.iplot(data, filename='bubblechart-size')
51
+
fig=go.Figure(data=[trace0])
52
+
fig.show()
58
53
```
59
54
60
55
### Setting Marker Size and Color
61
56
62
57
```python
63
-
import plotly.plotly as py
64
58
import plotly.graph_objs as go
65
59
66
60
trace0 = go.Scatter(
67
-
x=[1, 2, 3, 4],
68
-
y=[10, 11, 12, 13],
61
+
x=[1, 2, 3, 4], y=[10, 11, 12, 13],
69
62
mode='markers',
70
63
marker=dict(
71
64
color=['rgb(93, 164, 214)', 'rgb(255, 144, 14)',
@@ -75,8 +68,8 @@ trace0 = go.Scatter(
75
68
)
76
69
)
77
70
78
-
data = [trace0]
79
-
py.iplot(data, filename='bubblechart-color')
71
+
fig = go.Figure(data= [trace0])
72
+
fig.show()
80
73
```
81
74
82
75
### Scaling the Size of Bubble Charts
@@ -86,7 +79,6 @@ Note that setting 'sizeref' to a value greater than 1, decreases the rendered ma
86
79
Additionally, we recommend setting the sizemode attribute: https://plot.ly/python/reference/#scatter-marker-sizemode to area.
0 commit comments