Radar charts are great at displaying multiple variables for one data object. Radar charts typically look like what you would expect to see on a radar at an airport, showing you a map area with a zero point in the middle. A common place you can find radar charts in is the application performance. They have also been used in sports charts, displaying a player's or team's strengths and weaknesses. For this chart, we will build a budget estimate and the actual budget spend for a single project combined in one chart:
# -*- coding: utf-8 -*- import pygal radar_chart = pygal.Radar() radar_chart.title = 'Product Budget Figures' radar_chart.x_labels = ['Sales', 'Marketing', 'Development', 'Customer support', 'Information Technology', 'Administration'] radar_chart.add('Estimate', [40, 20, 100, 20, 30, 20, 10]) radar_chart.add('Actual Spending', [70, 50, 40, 10, 17, 8, 10]) radar_chart.render_to_file('radar_chart.svg')
Open the radar_chart.svg
file, and the result will be as shown in the following screenshot:
Take note of the x_labels
shown in the previous code. In this case, we have Sales
, Marketing
, Development
, Customer support
, Information Technology
, and Administration
as one array item.
The order of each item in the array is important, as the radar chart sets the value for each dataset in the order of the array, setting that label to each endpoint of the radar in a counter-clockwise fashion. Keep this in mind when building radar charts.
3.12.108.86