matplotlib雷达图最小值 [英] matplotlib radar plot min values

查看:330
本文介绍了matplotlib雷达图最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从matplotlib雷达示例开始,但是低于某些最小值的值消失了. 我有一个要旨此处.

I started with the matplotlib radar example but values below some min values disappear. I have a gist here.

结果看起来像

正如您在要点中看到的那样,A系列中D和E的值均为3,但根本不显示.

As you can see in the gist, the values for D and E in series A are both 3 but they don't show up at all.

正在进行一些缩放. 为了找出问题所在,我从原始值开始,一一删除.

There is some scaling going on. In order to find out what the problem is I started with the original values and removed one by one.

当我删除一个完整的系列时,比例会缩小. 这里有一个示例(去除因子5),并且比例尺在[0,0.2]范围内缩小.

When I removed one whole series then the scale would shrink. Here an example (removing Factor 5) and scale in [0,0.2] range shrinks.

来自

我不太关心缩放比例,但是我希望我的3分值能显示出来.

I don't care so much about the scaling but I would like my values at 3 score to show up.

非常感谢

推荐答案

实际上,尽管A系列中的D和E值绘制在图的中心,但它们的确显示.这是因为"y轴"的限制是自动缩放的.

Actually, the values for D and E in series A do show up, although they are plotted in the center of the plot. This is because the limits of your "y-axis" is autoscaled.

如果您希望有一个固定的最小半径",只需将ax.set_ylim(bottom=0)放入for循环中即可.

If you want to have a fixed "minimum radius", you can simply put ax.set_ylim(bottom=0) in your for-loop.

如果您希望最小半径是相对于最低标绘值的数字,则可以在for循环中包含类似ax.set_ylim(np.asarray(data.values()).flatten().min() - margin)的内容,其中margin是从最低标绘值到标绘值的距离.情节的中心.

If you want the minimum radius to be a number relative to the lowest plotted value, you can include something like ax.set_ylim(np.asarray(data.values()).flatten().min() - margin) in the for-loop, where margin is the distance from the lowest plotted value to the center of the plot.

在半径0处具有固定的中心(添加了标记以更好地显示点已绘制):

With fixed center at radius 0 (added markers to better show that the points are plotted):

通过设置margin = 1,并使用相对的y限制,我得到以下输出:

By setting margin = 1, and using the relative y-limits, I get this output:

这篇关于matplotlib雷达图最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆