简体   繁体   English

如何在pygal,python中修复ylim

[英]how to fix ylim in pygal, python

I tried to create radar graph with pygal. 我试图用pygal创建雷达图。 But not able to set ylim. 但无法设置ylim。 By default its start from zero to maximum value. 默认情况下,它从零到最大值开始。 My data is: 我的数据是:

import pygal

case1 = [0.549194,34.251384,36.154543,41.913,-139.627415,-20.655737]
case2= [0.549194,31.947443,34.558203,40.005646,-157.190631,-70.267567]
case3=[0.549194,31.436088,41.019637,48.748227,-34.859838,243.311831]


radar_chart = pygal.Radar()
radar_chart.title = 'PBIAS'
radar_chart.x_labels = ['A','B', 'C', 'D', 'E', 'F']
radar_chart.add('Model1', case1)
radar_chart.add('Model2', case2)
radar_chart.add('Model3', case3)

It might be very simple but not able to figure out how to do that. 这可能很简单,但无法弄清楚该怎么做。

Short answer, you can't just adjust the scale. 简短的答案,您不能只是调整比例。 The Radar class will set all values less than zero to zero before it generates the graph. Radar类将在生成图形之前将所有小于零的值设置为零。

You could pre-process your data and adjust all values up based on the smallest value below zero, but how to do this might depend on the type of data you are graphing. 您可以预处理数据并根据零以下的最小值上调所有值,但是如何执行此操作可能取决于所绘制数据的类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM