Better readable labels in pygal

73 Views Asked by At

I would like to visualize data with Pygal for this I have to use a radar, unfortunately the X-axis labels have very long labels, which leads to the fact that it becomes difficult to read and the labels are cut off (see picture). (Generated plot)

 import pygal
 from pygal.style import Style

 radar_chart = pygal.Radar(fill=True)
 radar_chart.style = Style(
    dots_size=14,
    label_font_size=10,
    x_label_rotation=20,
    human_readable=True,
    background='white',
)
 # example code
 skill_list = ["aaaaaaaaaaaaaaabbbbbbbbbbb"]*17

radar_chart.add(skill_list,
                [randint(1, 10) for _ in range(0, 17)])

radar_chart.x_labels= skill_list

 #......

How can I make the labels more readable without using a legend ?

Thanks in advance

1

There are 1 best solutions below

0
ChsharpNewbie On BEST ANSWER

I was able to solve the problem by adding the following:

TRUNCATE_LABEL = -1
radar_chart = pygal.Radar(fill=True, truncate_label=TRUNCATE_LABEL)