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

Pyramid charts

Typically, pyramid charts are used to display large amounts of data with high data values, such as population data, voter turnout, election results, and so on.

Let's try to build a chart; now, this pygal chart will look a little different. Pyramid charts look best with lots of data, and in this case, I've typed out a bunch of data you can use to practice with. For this chart, I'm going to create an array inside of another array, with each set of parenthesis as a subarray. This will be called miles_traveled.

Next, I'll create another array, thankfully not as large, called craft_type. This will keep an array of strings that represent types of space craft, which is equal to our amount of subarrays, in this case, Apollo Rockets, Russian ...

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