散布的编辑大小
这是我简单的情节图表的示例:
px.scatter(data_frame=testdf,
x = 'some_x',
y = 'some_y',
size = 'some_size',
color = 'sth_colorful',
title = 'stackoverflow',
range_x = [-10, 1100],
range_y = [-0.08, 1],
hover_name = 'sth_i_want_to_check',
animation_frame = 'year_of_course'
)
这是非常好的。令我困扰的一件事是,“ some_size”最小值约为20,最大值约为35,因此很难注意到圆圈之间的大小差异。 有什么方法可以管理这些直径?我想保留原始值以悬停。
Here's a sample of my simple plotly chart:
px.scatter(data_frame=testdf,
x = 'some_x',
y = 'some_y',
size = 'some_size',
color = 'sth_colorful',
title = 'stackoverflow',
range_x = [-10, 1100],
range_y = [-0.08, 1],
hover_name = 'sth_i_want_to_check',
animation_frame = 'year_of_course'
)
It is alomost good. One thing that bothers me is that 'some_size' min value is about 20 and max is about 35 so it is hard to notice the size difference between the circles.
Is there a way I can manage the diameter of these? I'd like to keep the original values to appear in a hover.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将参数
size ='Some_size'
传递给px.scatter
时,这直接确定标记在图上呈现时的大小。但是,您可以采取的措施是创建一个新列,称为
“ display_ize”
,带有标记的预期尺寸,并将custydata
设置为df [ 'some_size']
,因此您可以在HoverTemplate中访问这些值。之后,您可以循环浏览
px.scatter
中的所有跟踪,并修改HoverTemplate以显示Some_Size而不是display_size。例如:
When you pass the argument
size = 'some_size'
topx.scatter
, this directly determines the size of the markers as they render on the plot.However, what you can do to get around this is create a new column called
"display_size"
with your intended sizes for the markers, and setcustomdata
todf['some_size']
so you can access these values in the hovertemplate.After that, you can loop through all of the traces in your
px.scatter
and modify the hovertemplate to display some_size instead of display_size.For example: