Plotly入门(二)bubble_demo & style & scale
入门代码(二)# bubble_basic_demo
```
import plotly as py
import plotly.graph_objs as go
# ----------pre def
pyplt = py.offline.plot
# ----------code
trace0 = go.Scatter(
x=,
y=,
mode='markers',
marker=dict(
size=,
)
)
data =
pyplt(data, filename='tmp/bubble_baisc_demo.html')
```
# bubble_style
```
import plotly as py
import plotly.graph_objs as go
# ----------pre def
pyplt = py.offline.plot
# ----------code
trace0 = go.Scatter(
x=,
y=,
mode='markers',
text=['A<br>size: 40', 'B<br>size: 60', 'C<br>size: 80', 'D<br>size: 100'],
marker=dict(
color= ,
opacity=,
size=,
showscale= True,
)
)
data =
pyplt(data, filename='tmp/bubble_style.html')
```
# bubble_scale
```
import plotly as py
import plotly.graph_objs as go
# ----------pre def
pyplt = py.offline.plot
# ----------code
trace0 = go.Scatter(
x=,
y=,
text=['A</br>size: 40</br>default', 'B</br>size: 60</br>default', 'C</br>size: 80</br>default', 'D</br>size: 100</br>default'],
mode='markers',
name='default',
marker=dict(
size=,
sizemode='area',
)
)
trace1 = go.Scatter(
x=,
y=,
text=['A</br>size: 40</br>sizeref: 0.2', 'B</br>size: 60</br>sizeref: 0.2', 'C</br>size: 80</br>sizeref: 0.2', 'D</br>size: 100</br>sizeref: 0.2'],
mode='markers',
name = 'ref0.2',
marker=dict(
size=,
sizeref=0.2,
sizemode='area',
)
)
trace2 = go.Scatter(
x=,
y=,
text=['A</br>size: 40</br>sizeref: 2', 'B</br>size: 60</br>sizeref: 2', 'C</br>size: 80</br>sizeref: 2', 'D</br>size: 100</br>sizeref: 2'],
mode='markers',
name='ref2',
marker=dict(
size=,
sizeref=2,
sizemode='area',
)
)
data =
pyplt(data, filename='tmp/bubble_scale.html')
```
# bubble_colorscale
```
import plotly as py
import plotly.graph_objs as go
# ----------pre def
pyplt = py.offline.plot
# ----------code
data = [
{
'x': ,
'y': ,
'mode': 'markers',
'marker': {
'color': ,
'size': ,
'showscale': True
}
}
]
pyplt(data, filename='tmp/bubble_colorscale.html')
```
页:
[1]