Pies and Boxes


Pie Chart

Though pie charts aren't the most popular type of graphs, they can still provide some insights when the data items are a a few.

Lets plot a graph and see how it looks:


Description:

A pie chart requires the an array of wedges (fancy name for those sectors you see in pie charts or imagine a pizza slice..... yea, imagine and drool) which in our case is 'profits'

labelsWhat good is a pie chart without labels, lets say we're drawing a pie chart for Quarterly profits of an org and the labels will be Q1-Q4.

colors as usual could be the names of the colors like 'Black' and so on or Hex values

Now here comes an interesting part, EXPLODES:
Explodes is used to pull out that pizza slice which you like the most. Its just a simple list showing how far you want the slice to be pulled off from the center of the pie.

It could be as simple as [0,0,0,0.8] meaning, out of the 4 slices, i love the last one and so pull it out of the pie.
In our example, i have written a small function that can dynamically pull out the largest slice than hard coding the values.

autopct: Used to modify the text in each slice in a specific format. Play around with different values to know more.

pctdistance: Defines how far away the text in each slice be from the center of the pie should be.
There are many other parameters used to modify the pie charts. Have fun exploring the options.




Box Plots

Box-plots are frequently used for Statistical analysis. Lets see simple box plot example for now. In the later sections, when we do Exploratory Data Analysis, we will see how institutions could be framed using these plots.




Description:

boxplot() take an array or a sequence of vectors as input to plot and has some other customization options available. For instance, 'showmeans=True' lets us display the mean pictorially.

Note:
more sophisticated box plots will be covered under plotting with SEABORN

Comments