在我的代码中,当我用较小的值更改字体大小时,图例框不适应新的大小。你知道我可以添加什么属性来调整框大小吗?
使用的库是 Plotly。
fig.update_layout(showlegend=True, height=500, width=1000, title_text="Analysis of Latency",
legend=dict(
x=0, y=1,traceorder="normal",font=dict(size=10),bgcolor="WhiteSmoke")
最佳答案
在看到有关各种问题的一些评论表明无法做到这一点后,似乎有一种方法可以很好地工作。
legend.sizes = seq(80, 160, 20)
ax = list(zeroline = FALSE, showline = FALSE, showticklabels = FALSE, showgrid = FALSE)
mk = list(sizeref=0.1, sizemode="area")
p.map = plot_geo(DF, locationmode = 'USA-states') %>%
add_markers(x = ~long, y = ~lat, color = ~Group, size = ~Value, marker = mk) %>%
layout(geo = list(scope = 'usa'))
p.legend = plot_ly() %>%
add_markers(x = 1, y = legend.sizes, size = legend.sizes, showlegend = F, marker = mk) %>%
layout(xaxis = ax, yaxis = list(showgrid = FALSE))
subplot(p.legend, p.map, widths = c(0.1, 0.9))
关于python - 是否可以更改 Plotly 中图例框的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62867362/