x2016 = data[data.year == 2016].iloc[:20,:]
num_students_size = [float(each.replace(',', '.')) for each in x2016.num_students]
international_color = [float(each) for each in x2016.international]
trace1 = go.Scatter(
x = x2016.world_rank,
y = x2016.teaching,
mode = "markers",
marker=dict(
color = international_color,
size = num_students_size,
showscale = True
),
text = x2016.university_name
)
data5 = [trace1]
iplot(data5)
这将生成气泡图,而不显示标签。如何添加标签请帮助]1
您的
[data5]
更适合作为go.Figure()
对象这里有一个很好的顺序:https://plotly.com/python/line-and-scatter/#bubble-scatter-plots
以下是地物标签的参考: https://plotly.com/python/figure-labels/
此处提供其他相关帮助和教程: https://plotly.com/python/line-and-scatter/
因此,要在这里给出一个一般性提示,应该使用以下方法:
相关问题 更多 >
编程相关推荐