1 00:00:00,250 --> 00:00:03,590 So far we've just been displaying our charts to the screen. 2 00:00:03,590 --> 00:00:05,420 As I mentioned earlier in the course, 3 00:00:05,420 --> 00:00:09,860 one of the Matplotlib's strengths is producing the publication ready images. 4 00:00:09,860 --> 00:00:13,010 Let's see how we can save some visualizations of our Iris data, so 5 00:00:13,010 --> 00:00:14,580 we can share our results with others. 6 00:00:15,800 --> 00:00:19,580 Let's use our box plot code here as an example to generate our files. 7 00:00:19,580 --> 00:00:26,180 To save files, we need to utilize matplotlib's figure object and save fig method. 8 00:00:26,180 --> 00:00:31,330 Like I mentioned, we assigned a variable, fig, to plt.figure. 9 00:00:31,330 --> 00:00:36,950 We come in here, plt.figure. 10 00:00:39,055 --> 00:00:40,947 And then down here at the bottom. 11 00:00:45,058 --> 00:00:50,280 savefig, and we pass in a file name for our chart. 12 00:00:50,280 --> 00:00:58,530 We'll call it petal_length_boxplot.png. 13 00:00:58,530 --> 00:00:59,668 We can run this out. 14 00:01:08,342 --> 00:01:10,200 This is pretty cool. 15 00:01:10,200 --> 00:01:15,650 We can see if we go over here into our folder, and there it is. 16 00:01:15,650 --> 00:01:19,130 Our petal_length_boxplot.png file was created, now, 17 00:01:19,130 --> 00:01:23,700 in this example, we generated the PNG file which is great for websites. 18 00:01:23,700 --> 00:01:27,520 Let's jump back over to our notebook and see what other file types are supported. 19 00:01:30,270 --> 00:01:31,490 Let's do a new cell. 20 00:01:33,610 --> 00:01:43,285 So we import matplotlib.pyplot as plt. 21 00:01:46,778 --> 00:01:50,756 Send our figure object, and 22 00:01:50,756 --> 00:01:59,216 then if we print out canvas.get_supported_filetypes. 23 00:02:00,982 --> 00:02:02,200 And run our cell. 24 00:02:04,554 --> 00:02:08,722 As you can see, there's support for a lot of different file types or 25 00:02:08,722 --> 00:02:12,835 in matplotlib language hard copy or non-interactive back ends. 26 00:02:13,855 --> 00:02:17,615 These handle most printed or static display needs. 27 00:02:17,615 --> 00:02:22,425 While it is beyond the scope of this course, there are also user interface or 28 00:02:22,425 --> 00:02:25,105 interactive back end options too. 29 00:02:25,105 --> 00:02:28,085 I'll put a link in the teacher's notes for resources on those. 30 00:02:28,085 --> 00:02:29,215 This approach for 31 00:02:29,215 --> 00:02:32,915 finding supported file types works outside of jupyter notebooks too. 32 00:02:32,915 --> 00:02:36,185 In case you want to use matplotlib's power in a different environment. 33 00:02:37,210 --> 00:02:39,880 We've covered a bunch of stuff in this stage. 34 00:02:39,880 --> 00:02:42,600 We explored our Iris Dataset in several ways, 35 00:02:42,600 --> 00:02:46,260 used several different visualization tools and techniques, and 36 00:02:46,260 --> 00:02:49,860 learned how to leverage matplotlib to find patterns in data. 37 00:02:49,860 --> 00:02:54,240 Data visualization is a fundamental aspect of many job roles today. 38 00:02:54,240 --> 00:02:57,450 For both data experts and non-experts alike. 39 00:02:57,450 --> 00:02:59,770 You're well on your way to communicating information and 40 00:02:59,770 --> 00:03:01,640 generating useful visualizations. 41 00:03:03,290 --> 00:03:06,630 When we get back together, let's move on to a different data set and 42 00:03:06,630 --> 00:03:11,410 answer some specific business decision questions with our new data viz skills.