Python Data Visualization Transcripts
Lecture: Bar charts
0:00 Another type of plot that will create a lot is very useful. Is a bar plot. So we can create one easily in matplotlib using
0:11 the same format we've already been talking about. It's easily enough called bar, we can go ahead copy our information and now we
0:21 have a bar plot and you may look at this and think, well could we maybe change the X axis to have more years and we can absolutely
0:30 do that. So similar to setting the X takes on our line chart, we can do that and you'll see now we have Years every two increments.
0:53 You might have also noticed that the year came through as an integer, so there was none of the decimal points that we saw in the line chart.
1:02 And this is where behind the scenes mat plot lib knows that bar chart is for
1:07 categorical variables. And so it's doing some work behind the scenes to make these whole
1:13 numbers or categories instead of continuous or floating point numbers. So that's just a little something that's going on behind the scenes.
1:20 The other thing we could do with a bar chart if we wanted to is we could do a horizontal bar chart and instead of calling it bar,
1:27 bar H and now we have a horizontal bar chart all relatively straightforward given the
1:36 API, that we've talked about and hopefully to start to hammer home what
1:41 the matplot lib api looks like and how you can use it to create multiple types of charts.