Python Data Visualization Transcripts
Chapter: Matplotlib
Lecture: Styles

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We've gone through a lot of examples of matplot lib, code. And one of the things that you probably noticed is that the visualizations
0:08 on average don't look very good. You can get the feeling that there's opportunities to customize the colors,
0:15 but it would likely take a lot of code to set this visualization up to look
0:22 more visually appealing. Fortunately matplot lib has some shortcuts available to us using styles
0:27 Here's a list of all of the styles that are available to us. Let me show you how you would actually use the style.
0:38 So let's say we wanted to use the 'ggplot' style, we would set that and behind the scenes it configures a bunch of different parameters.
0:46 So let's just try for simple scatter plot. And now when we run it we get a much different display of the plot and
1:00 maybe you can play around with this and figure out what works best for your own
1:06 visualization. But I'll show a quick example of how you can print out several of
1:12 the different styles and apply it to a visualization using a context manager.
1:47 So let me walk through what we've done, I created a list of a sample of different styles and you can play around with this and see which ones you like.
1:55 And then I use the plot.style context manager to generate our scatter plot using that different style. I also use an
2:05 F string so that you can see what the style is. So let's take a look at the difference in some of these styles and you can
2:24 see that the style controls a lot of different aspects of the visualization controls the color the grids, the fonts,
2:32 even the size of the visualization. So as you play around with matplot lib and use it, you'll find the style that works best for your own scenarios,
2:43 and I encourage you to play around with them and see what is visually appealing for your own applications.


Talk Python's Mastodon Michael Kennedy's Mastodon