jupyter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Note
transforms
are deprecated inplotly
v5 and will be removed in a future version.
import plotly.io as pio
subject = ['Moe','Larry','Curly','Moe','Larry','Curly','Moe','Larry','Curly','Moe','Larry','Curly']
score = [1,6,2,8,2,9,4,5,1,5,2,8]
data = [dict(
type = 'scatter',
x = subject,
y = score,
mode = 'markers',
transforms = [dict(
type = 'groupby',
groups = subject,
styles = [
dict(target = 'Moe', value = dict(marker = dict(color = 'blue'))),
dict(target = 'Larry', value = dict(marker = dict(color = 'red'))),
dict(target = 'Curly', value = dict(marker = dict(color = 'black')))
]
)]
)]
fig_dict = dict(data=data)
pio.show(fig_dict, validate=False)
See https://plotly.com/python/reference/ for more information and chart attribute options!