[英]How would I graph a scatter plot from a 2d array, where the size of the markers is determined by the values in the array?
[英]How to display the values above markers in plotly scatter graph object?
我似乎找不到始終在 python plotly 中的點上方顯示散點 y 值的參數。
我試圖搜索它但失敗了。 我只想讓 hover 之類的號碼一直亮着。
您在文檔中需要類似的東西嗎? https://plotly.com/python/line-and-scatter/#connected-scatterplots
import plotly.express as px
df = px.data.gapminder().query("country in ['Canada', 'Botswana']")
fig = px.scatter(
df, x="lifeExp", y="gdpPercap", color="country", text="year"
).update_traces(textposition="top center")
fig.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.