bokeh Saving Figures Video Lecture Transcript This transcript was automatically generated by Zoom, so there may be discrepancies between the video and the text. 17:22:28 Hi, everybody! Welcome back in this video. We're gonna learn about how you can save your Boca figures to an HTML file 17:22:39 So we're gonna talk about saving figures mostly. 17:22:42 This will be in this notebook just about saving them to HTML. 17:22:44 Files, but then, in the end I will mention different ways that you can try and save them as static plots as Png or Sbg files 17:22:54 So in order to save our figures that we've made as an HTML. 17:22:58 File. This means that it'll be openable in most web browsers that you'd be using, and then it will have all the nice interactivity, you might add, like a hover tool moving the figure around in the coordinate act in the coordinate plane, as well as clicking or if you write one with 17:23:15 Javascript, or make a dashboard something like that. 17:23:18 All that can be saved. So in order to do that, we're first going to have to image a couple of things. 17:23:24 So the remember in the old notebooks the previous ones we've been using output. 17:23:28 Nope. Well, this time we're going to be using output file. Why is that? 17:23:32 Because the output of our figure we want to be saved to a file. 17:23:37 We also are going to import save as well, which will allow us to save the figure so we're first going to do from Boca dot I/O import output file comma, save. 17:23:54 So in this example, where we'll be relying on our our classic data set for Boko, which is this automobile data set. 17:24:01 So the first thing we're going to do is call output, underscore file. 17:24:06 And then you're going to import the file name which I've decided to make mine auto. 17:24:11 Mpg. Underscore example dot HTML. 17:24:15 So then I just go ahead and I make my figure the way I would before. 17:24:20 So I make my source. I make my figure object with the labels. 17:24:25 I make some edits to the labels that I want. 17:24:28 I add my scattered glyph with the various, you know, with the hover interactivity. 17:24:34 And then I add the tool tip, and then I show it. 17:24:37 Now, because I've called out the output file instead of or after output notebook what's going to happen when I run? 17:24:47 This is instead of plotting up, popping up, down here, and the notebook and an HTML file is going to pop up in my browser. 17:24:55 I said it was gonna do that. That's because I forgot to run output file. 17:24:59 So now that I've run output files the HTML file that got saved, you can see auto. 17:25:04 Mpg, example, this, yeah. Opened up and it has the interactivity with the hover where the point changes color and then the making the model pops up. 17:25:16 I can also see I can move my plot around and the other tools work, for instance, like the box zoom, and and going back 17:25:29 So with the reset button. Okay, so let's go ahead and close that 17:25:35 So that's what happens when you call show with output file. 17:25:41 Alternatively. Instead of running show, you could just call save P. 17:25:46 So at the bottom, instead of show. P. I call save P. 17:25:49 And then the name of the file shows up at the bottom, and instead of popping up as an HTML file, I can go back and check the auto. 17:26:02 Mpg example pops up and I can click on it, and it opens up. 17:26:05 Has all the same interactivity. So that's it. That's it. 17:26:10 That's all you have to do to save your file as an HTML file. 17:26:15 There are ways to save your images as static image file types, for example, as Png's or as Svg files. 17:26:23 But at the time of this writing it's a little bit you have to install some extra python packages, and those some of those are not easy to install. 17:26:32 So, I feared it wasn't necessarily worth the time to figure out how to do that, mainly because we have other ways of saving static figures like with Matt Plot, live and Seaborn. 17:26:44 And then the next section. We'll see how to save static figures that were made with plot, lead. So I figured, if it's if you're really interested in seeing how to save a static figure in Boca, I've provided Links to the Boca documentation that documentation pages that are relevant 17:26:58 to you, and you can take your time and figure it out but and you know, in terms of time of the course I figured this was not worth our time to you know mess around with installing additional packages that are kind of weird so anyway, that being said we now know how to save our wonderful Boca 17:27:15 figures as HTML files, and you all have some paths of investigation to try and learn how to save them. 17:27:22 As Png or Svg files should you want to. 17:27:26 So in the next notebook will continue all we're end our Boca content by talking about some next steps you can take. 17:27:32 I hope you enjoyed learning how to save these figures.