matplotlib radar plot min values

China☆狼群 提交于 2019-12-10 11:59:22

问题


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

The result looks like

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.

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.

From

to

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

Many thanks


回答1:


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.

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

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.

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

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



来源:https://stackoverflow.com/questions/21556136/matplotlib-radar-plot-min-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!