O'Reilly logo

Learning Python Data Visualization by Chad Adams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Label settings

Let's take a look at a traditional line chart where we can use labels. Here's a simple chart with some dummy datasets. Copy the code into your editor of choice and run the script. Your output should be what is shown in the next screenshot.

You can also set label settings using similar parameters used with our legend. Let's build a simple line chart that we can see our changes on. Add the following code to an editor of your choice and run the script. Be sure to save the output as lineparam.svg:

# -*- coding: utf-8 -*- import pygal param_line_chart = pygal.Line() param_line_chart.title = 'Parameter Line Chart' param_line_chart.x_labels = map(str, ["Data Object 1", "Data Object 2", "Data Object 3", "Data Object 4", "Data Object 5", "Data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required