0 1 00:00:00,930 --> 00:00:01,830 All right. 1 2 00:00:02,070 --> 00:00:07,420 So in this lesson we're gonna be covering some advanced data visualization techniques. 2 3 00:00:07,530 --> 00:00:12,800 And I'm going to show you how to create 3-D charts in Python. 3 4 00:00:13,590 --> 00:00:17,840 So let's start off with a section heading, 4 5 00:00:17,860 --> 00:00:20,530 change this to Markdown. 5 6 00:00:20,960 --> 00:00:35,310 And I'm going to use the pound symbol, and then write "Example 4 - Data Viz with 3D Charts" and in the 6 7 00:00:35,310 --> 00:00:36,530 same markdown cell, 7 8 00:00:36,530 --> 00:00:40,810 we're only playing with a little bit more of the LaTeX notation. 8 9 00:00:40,830 --> 00:00:43,860 Let me show you the function that we're going to minimize. 9 10 00:00:43,860 --> 00:00:47,050 This function will have two variables. 10 11 00:00:47,050 --> 00:00:54,020 So it's both going to have an x and y, and we'll have to minimize our cost across both of these inputs. 11 12 00:00:54,030 --> 00:01:00,680 So both of these parameters will have to be optimized in order to minimize the cost. 12 13 00:01:00,690 --> 00:01:03,800 So here's what our cost function will look like. 13 14 00:01:03,810 --> 00:01:16,410 So I'm going to add a subheading and I'll say "Minimize $$f(x,y) =" and 14 15 00:01:16,410 --> 00:01:26,910 then I'm going to use the backslash to put in a keyword here - frac for fraction and then 15 16 00:01:26,910 --> 00:01:34,530 I'm going to use a curly brace of 1, close the curly brace and then have another opening curly brace 16 17 00:01:34,680 --> 00:01:40,560 and then put a 2, and another closing curly brace. And then I'm going to put two dollar signs at the end 17 18 00:01:41,430 --> 00:01:48,210 for my closing tag. And now let me press Shift+Enter to show you what this LaTeX notation actually looks like. 18 19 00:01:48,390 --> 00:01:57,090 So what you see here is that we've created a fraction by using this tag right here. The top part of the 19 20 00:01:57,090 --> 00:02:03,690 fraction is between the first set of curly braces and the bottom part of the fraction is in the second 20 21 00:02:04,050 --> 00:02:06,360 pair of curly braces. 21 22 00:02:06,360 --> 00:02:13,440 The function that we're actually gonna be minimizing isn't 1/2 it is 3 to the power of 22 23 00:02:13,440 --> 00:02:22,920 and then it'll be another opening curly brace -x^2-y^2, 23 24 00:02:23,310 --> 00:02:27,270 closing curly brace and then I'll add 1 at the end. 24 25 00:02:27,930 --> 00:02:31,050 Now let me hit Shift+Enter to show you what this function looks like. 25 26 00:02:31,060 --> 00:02:31,630 Voila. 26 27 00:02:31,970 --> 00:02:38,900 Now a nice little trick with complicated functions like this is that we can split it up a little bit. 27 28 00:02:38,910 --> 00:02:47,010 This also makes it easier to write it in the Python code so we can also write it like this, we can say "Minimise 28 29 00:02:47,370 --> 00:02:59,820 $$ f(x,y) = "and then have again the "\frac{1}"and 29 30 00:02:59,820 --> 00:03:08,970 then "{r+1}$$", and then "where 30 31 00:03:09,060 --> 00:03:18,870 $r$ and $3^ 31 32 00:03:18,960 --> 00:03:29,450 {-x^2 - y^2}$" 32 33 00:03:29,550 --> 00:03:34,350 And what this line of markdown will nicely do is show us again the difference between using two dollar 33 34 00:03:34,350 --> 00:03:41,400 signs in the LaTeX markdown or one dollar sign in a LaTeX markdown. 34 35 00:03:41,400 --> 00:03:47,520 So with the double dollar sign we get that equation centered and with a single dollar sign we get that 35 36 00:03:47,910 --> 00:03:50,490 notation in line. 36 37 00:03:50,490 --> 00:03:53,950 Now let's write the Python code to express this function. 37 38 00:03:54,210 --> 00:04:00,630 So I'm going to go with the second way of expressing this equation because I think it makes it much 38 39 00:04:00,630 --> 00:04:02,570 more clear and easy. 39 40 00:04:02,640 --> 00:04:17,970 So I'm going to say "def f(x,y):", "r=3**(-x** 40 41 00:04:17,970 --> 00:04:23,690 2-y**2)". 41 42 00:04:24,030 --> 00:04:32,040 And then I'll say "return 1 / (r+1)". 42 43 00:04:32,100 --> 00:04:33,480 And I'll hit Shift+Enter. 43 44 00:04:33,990 --> 00:04:39,270 And this is what our function looks like in Python. 44 45 00:04:39,930 --> 00:04:46,020 So even though we could have written all of this in one line here after the return keyword I find it 45 46 00:04:46,020 --> 00:04:48,790 much more readable if we split it up like this. 46 47 00:04:48,840 --> 00:04:51,660 Now let's create a chart with this function. 47 48 00:04:51,660 --> 00:04:58,500 Let's see what this actually looks like on a graph. Now as always with charts we've got to make some data 48 49 00:04:58,500 --> 00:05:04,410 first so we're going to use that linspace function again, but this time we're gonna create data for 49 50 00:05:04,470 --> 00:05:07,320 both our x's and our y. 50 51 00:05:07,380 --> 00:05:15,540 So I'm going to create a variable called x_4 is equal to np for numpy, "linspace 51 52 00:05:16,200 --> 00:05:28,890 (start=-2, stop=2)", and then num=200 and I'll do the 52 53 00:05:28,890 --> 00:05:38,220 same for our y because we've got two variables now, so we'll have "y_4 = np. 53 54 00:05:38,220 --> 00:05:49,340 linspace(start=-2, stop=2, num=200)". 54 55 00:05:49,350 --> 00:05:55,260 So, while we're at it let's take a look at what the type of x_4 actually is, what type of 55 56 00:05:55,380 --> 00:05:57,420 object is this. 56 57 00:05:57,420 --> 00:06:05,700 We can see that linspace gives us a numpy array, an ndarray and we can also see the same thing 57 58 00:06:06,060 --> 00:06:14,130 if I move my cursor over linspace, hit Shift+Tab and then I can see here if I press the plus sign 58 59 00:06:18,180 --> 00:06:27,660 and I scroll down, it returns a ndarray. Yeah the linspace function returns an ndarray. So 59 60 00:06:27,660 --> 00:06:33,340 I can see this both if I print out the type or if I take a look at the documentation. 60 61 00:06:33,780 --> 00:06:39,720 Now the interesting thing with arrays is that they have a shape - they have rows and they have columns. 61 62 00:06:39,720 --> 00:06:49,080 So what we can do is we can look at the shape of this array, we can say "'Shape of X array', x_ 62 63 00:06:49,230 --> 00:06:59,330 4.shape'. Yeah, so shape is an attribute of the ndarray. So let's print this out, see what we get. 63 64 00:06:59,870 --> 00:07:05,350 So we can see that we've got a one dimensional array with 200 rows. 64 65 00:07:05,480 --> 00:07:12,290 A mathematician would refer to this type of data structure as a vector. 65 66 00:07:13,010 --> 00:07:21,590 Let's keep that in mind for later and move on to trying to plot stuff. But before we dive into plotting 66 67 00:07:21,590 --> 00:07:27,200 things right away, let's have a quick think about what a plot might consist of. 67 68 00:07:27,200 --> 00:07:34,340 If we look at our previous Python code that say generated this plot right here what we see is that our 68 69 00:07:34,340 --> 00:07:40,670 chart is in fact made up of different pieces that come together for the final product. 69 70 00:07:40,670 --> 00:07:47,180 So for example we had our data points that were plotted as a scatter plot on the diagram and this was 70 71 00:07:47,180 --> 00:07:50,440 separate from the line that was being charted. 71 72 00:07:50,480 --> 00:07:58,400 Also our plot had other bits of information too, right? It had things like title and labels and so on. 72 73 00:07:58,400 --> 00:08:03,620 The point I'm trying to make is that we've actually used several different types of Python objects to 73 74 00:08:03,620 --> 00:08:11,450 make our final chart. In this lesson we're gonna be generating a 3D plot that will look something like 74 75 00:08:11,450 --> 00:08:12,650 this. 75 76 00:08:12,710 --> 00:08:18,380 However, to make this 3D plot we have to start manipulating other types of Python components that make 76 77 00:08:18,380 --> 00:08:19,950 up this diagram. 77 78 00:08:20,120 --> 00:08:26,570 These Python components include the figure object and the axes object. 78 79 00:08:26,570 --> 00:08:28,670 Now we've already met the figure. 79 80 00:08:28,670 --> 00:08:31,390 Remember how we sized our plots previously? 80 81 00:08:31,790 --> 00:08:35,640 We did that by manipulating the figure size. 81 82 00:08:35,900 --> 00:08:44,660 So let's come down here, I'm going add a little comment "Generating 3D plot" and let's size our new plot with 82 83 00:08:44,870 --> 00:08:58,050 "plt.figure(figsize =)", and then we'll pass in a list with the [16, 83 84 00:08:58,740 --> 00:09:00,050 12]. 84 85 00:09:00,750 --> 00:09:03,810 So this is how we sized our figure always. 85 86 00:09:03,810 --> 00:09:06,330 Now here's something new that we can do with this code. 86 87 00:09:06,330 --> 00:09:15,090 If I hit Shift+Tab on this function then I can see by expanding the documentation and scrolling down 87 88 00:09:18,120 --> 00:09:21,180 that this function in fact returns something. 88 89 00:09:21,210 --> 00:09:29,040 This figure function has an output and it returns, well it returns a figure. Yeah a figure 89 90 00:09:29,040 --> 00:09:31,660 instance will be returned. 90 91 00:09:31,990 --> 00:09:37,890 And since this bit of code has an output, we can actually store that output somewhere. 91 92 00:09:37,890 --> 00:09:46,860 So I'm going to create an object, call it fig and set it equal to the output from this bit of code here. 92 93 00:09:46,920 --> 00:09:52,710 So now our figure object is stored in a variable called fig. 93 94 00:09:53,040 --> 00:09:56,850 At this point you might be asking what's a figure? 94 95 00:09:56,850 --> 00:10:04,680 And the answer is, it's a little bit abstract, conceptually a figure is just a matplotlib object that 95 96 00:10:04,770 --> 00:10:12,180 allows us to manipulate our final chart in certain ways, like by say changing the size or adding axes 96 97 00:10:12,180 --> 00:10:13,320 to the chart. 97 98 00:10:13,440 --> 00:10:21,180 In fact you can think of a figure as a kind of top level container that contains other elements in the 98 99 00:10:21,180 --> 00:10:21,990 chart. 99 100 00:10:22,020 --> 00:10:28,790 That's just how the matplotlib library is structured. In their code that we're using 100 101 00:10:28,830 --> 00:10:35,880 the figure is a container for other bits of the chart. Now, the follow up question is what kind of other 101 102 00:10:35,940 --> 00:10:39,520 elements are contained in a figure? 102 103 00:10:39,550 --> 00:10:47,880 Well one element actually is the chart's axes and we are particularly interested in the chart's axes because 103 104 00:10:47,880 --> 00:10:49,440 we're gonna have to manipulate them. 104 105 00:10:49,650 --> 00:10:52,380 So the axes we're going to store in a variable as well. 105 106 00:10:52,530 --> 00:11:07,880 So going to say "ax = fig.gca(projection='3d')". 106 107 00:11:08,010 --> 00:11:15,540 So what's happening here is that we're calling a function called gca which is short for "get current 107 108 00:11:15,720 --> 00:11:16,650 axes". 108 109 00:11:16,650 --> 00:11:22,740 So we're getting the axes from the figure and we're storing them in a variable as well. 109 110 00:11:22,920 --> 00:11:31,850 So our fig object came in handy here on this line, because we're using the fig object to grab our axes. 110 111 00:11:31,950 --> 00:11:37,980 Now I can't actually run the code like this, if I press Shift+Enter, I'm going to get an error 111 112 00:11:42,370 --> 00:11:48,230 and the error reads "ValueError: Unknown projection '3d'". 112 113 00:11:48,670 --> 00:11:55,630 The reason we're getting this error is because we have to import our 3D axes into our Python notebook 113 114 00:11:55,860 --> 00:12:01,930 so I'm going to scroll back up all the way where we had notebook imports and packages 114 115 00:12:01,930 --> 00:12:19,210 and here I'm going to add the code "from mpl_toolkits.mplot3d.axes3d import 115 116 00:12:20,110 --> 00:12:26,070 Axes3D". 116 117 00:12:26,260 --> 00:12:27,560 So it's quite a mouthful. 117 118 00:12:27,610 --> 00:12:29,800 We're importing something very specific. 118 119 00:12:29,950 --> 00:12:38,170 So "from mpl_toolkits.mplot3d.axes3d import Axes3d". 119 120 00:12:38,950 --> 00:12:47,010 And then I'm going to have to hit Shift+Enter on this import. That way we've refreshed our Python notebook. 120 121 00:12:47,260 --> 00:12:53,860 And if I scroll all the way down to the bottom I can now go to the cell and actually run it. 121 122 00:12:53,950 --> 00:13:02,760 It will recognise our 3D axes and will actually generate an empty chart for us like this. 122 123 00:13:02,830 --> 00:13:03,060 Okay, 123 124 00:13:03,070 --> 00:13:09,910 I'm going to click back into the cell and add our next line of code because now that we've got our 3D axes 124 125 00:13:10,270 --> 00:13:13,180 we can try plotting our function on them. 125 126 00:13:13,450 --> 00:13:16,280 The method that we're going to call on our axes object, 126 127 00:13:16,480 --> 00:13:25,870 so writing "ax." is called "plot_surface" so we're not plotting a line, we're plotting a surface because 127 128 00:13:25,870 --> 00:13:33,950 now we're in 3D space. So we'll say "plot_surface()" and then we have to feed our data to it. 128 129 00:13:33,970 --> 00:13:42,400 So we're going to say x_4, and then y_4 and then for our z axis, our third dimension 129 130 00:13:42,460 --> 00:13:53,170 it's gonna be f(x_4, y_4) and then two parentheses at the end. 130 131 00:13:53,170 --> 00:13:58,510 So this is the function that we want to call to actually plot a 3D chart and we're doing this on the 131 132 00:13:58,540 --> 00:14:05,870 3D axes object itself. But before I run this, there's still something I have to do. 132 133 00:14:05,890 --> 00:14:13,600 So let me quickly pull up the documentation here by pressing Shift and then Tab on my keyboard and hitting 133 134 00:14:13,600 --> 00:14:22,630 the little plus sign here, we can see in the signature there are three required inputs - an x, a y, and a z, but scrolling 134 135 00:14:22,630 --> 00:14:30,970 down we can also read that these three inputs need to be 2d arrays. 135 136 00:14:30,970 --> 00:14:33,100 So they need to have two dimensions. 136 137 00:14:33,620 --> 00:14:42,100 But let me ask you this - is x_4 and y_4 a 2D array as it is right now? 137 138 00:14:42,430 --> 00:14:43,480 The answer is no. 138 139 00:14:44,560 --> 00:14:50,980 If we look here, our shape that we've printed out is in fact showing us that we have a one dimensional 139 140 00:14:50,980 --> 00:14:51,730 array. 140 141 00:14:51,880 --> 00:14:56,500 So it's got two rows but it's only got one dimension. 141 142 00:14:56,800 --> 00:15:02,770 So there's something we have to do, we have to make this two dimensional. Let me add some more lines on 142 143 00:15:02,830 --> 00:15:07,110 the top here. To meet our requirement for our plot surface function, 143 144 00:15:07,120 --> 00:15:14,590 we have to transform our x_4 and our y_4 to a two dimensional array. 144 145 00:15:14,650 --> 00:15:20,350 So I've got a one dimensional vector and it should become a two dimensional matrix. 145 146 00:15:20,590 --> 00:15:25,180 And this is where our good friend numpy comes to the rescue 146 147 00:15:25,180 --> 00:15:31,840 once again. We've got a really, really good numpy function called meshgrid that we're gonna make use 147 148 00:15:31,840 --> 00:15:34,840 of to do just that. 148 149 00:15:34,840 --> 00:15:41,640 So I'm going to type "x_4, y_4 =", 149 150 00:15:41,860 --> 00:15:44,930 you'll notice I'm using sequence unpacking here. 150 151 00:15:45,040 --> 00:15:48,820 So "x_4, y_4 = 151 152 00:15:48,860 --> 00:15:57,610 np.meshgrid(x_4, y_4)" 152 153 00:15:57,610 --> 00:15:59,500 So what does mesh grid do? 153 154 00:15:59,500 --> 00:16:08,530 If I look at the docs, I can see that this method returns a coordinate matrix from a coordinate vector 154 155 00:16:09,010 --> 00:16:17,680 so it will return to us a two dimensional array given a one dimensional array. Let's print out the shape 155 156 00:16:17,770 --> 00:16:27,970 so I can prove this to you. I'll say "'Array after meshgrid', x_4.shape", let's 156 157 00:16:27,970 --> 00:16:36,970 run this again. And here we see that our array now is 200 rows by 200 columns. 157 158 00:16:37,310 --> 00:16:43,930 So I can show you what this would look like actually but I'm not going to show you a 200 by 200 matrix 158 159 00:16:44,440 --> 00:16:46,900 I'll just show you a five by five. 159 160 00:16:46,900 --> 00:16:56,170 So I'm going to change the arguments here to our linspace function and then down here I'll say x_4 160 161 00:16:56,820 --> 00:17:02,200 and we can actually see what it looks like if it was a five by five matrix. 161 162 00:17:02,200 --> 00:17:09,500 So this still is two dimensional in contrast to what it was before we called the meshgrid function. 162 163 00:17:09,670 --> 00:17:16,260 This print statement is showing us that here at this point it was still one dimensional but by the time 163 164 00:17:16,260 --> 00:17:21,660 we've run meshgrid it has become two dimensional. 164 165 00:17:21,660 --> 00:17:22,000 All right. 165 166 00:17:22,050 --> 00:17:31,350 So I'll delete this really quick here and I'll change our arguments back to 200 and I'll rerun 166 167 00:17:31,350 --> 00:17:32,400 the cell. 167 168 00:17:32,400 --> 00:17:34,980 Now it's time to look at our 3D chart. 168 169 00:17:34,980 --> 00:17:44,640 So let me add plt.show() and hit Shift+Enter. Scrolling down we see our beautiful 169 170 00:17:44,760 --> 00:17:52,260 surface being plotted on a 3D axis just like this. 170 171 00:17:52,260 --> 00:17:53,250 Very nice. 171 172 00:17:53,250 --> 00:17:55,950 So I'm very proud of our creation here. 172 173 00:17:56,250 --> 00:17:59,890 But the I think it could use some improvements. 173 174 00:17:59,940 --> 00:18:04,590 For starters I can't really tell which axes is which 174 175 00:18:04,590 --> 00:18:06,440 just by looking at this. 175 176 00:18:06,450 --> 00:18:11,980 So what we're gonna do is we're gonna add some labels to our axes. 176 177 00:18:12,000 --> 00:18:12,810 Now here's the thing. 177 178 00:18:12,810 --> 00:18:17,130 Previously we've added plt.xlabel, 178 179 00:18:17,130 --> 00:18:26,730 yeah and had a function call like this but we've got a 3D chart and so we're going to call our method 179 180 00:18:26,880 --> 00:18:28,440 on our axes object. 180 181 00:18:28,440 --> 00:18:39,810 So we gonna say "ax.set_xlabel()", and then we'll pass in the string X with a font size 181 182 00:18:41,980 --> 00:18:51,520 equal to 20 and I'm gonna copy this code, paste it two more times, but instead of the X label I'll have 182 183 00:18:51,520 --> 00:18:55,510 the Y label and the Z label as well. 183 184 00:18:55,510 --> 00:19:07,300 And of course I'm going to change the string to display to 'Y' and then I'll change the z axes to 184 185 00:19:07,450 --> 00:19:18,490 'f(x, y) - Cost' so that way we'll have a label on all our three axes of our 3D chart. 185 186 00:19:18,550 --> 00:19:23,670 Let me hit Shift+Enter and update what's on screen. Voila. 186 187 00:19:23,670 --> 00:19:26,810 So this is what the Z label looks like. 187 188 00:19:26,960 --> 00:19:31,920 We've got our X label and our y label. Brilliant. 188 189 00:19:31,920 --> 00:19:34,560 So that's starting to look pretty decent. 189 190 00:19:34,560 --> 00:19:37,530 But you know what, we can make it look even better. 190 191 00:19:37,890 --> 00:19:45,780 And the way we're gonna do this is by using color, adding color provides so much additional information 191 192 00:19:46,200 --> 00:19:48,210 when it comes to data visualization. 192 193 00:19:48,840 --> 00:19:56,460 So my objective looking at this is to be able to visually differentiatem not just based on where things 193 194 00:19:56,580 --> 00:19:57,120 are, 194 195 00:19:57,510 --> 00:20:04,800 if a value is high or low, but what color a certain area is on this chart. I want the color itself to 195 196 00:20:04,800 --> 00:20:07,380 tell me if the cost is high or low. 196 197 00:20:07,380 --> 00:20:16,660 And to do that we're gonna have to import a module called the color map. So I'm going to scroll back up and 197 198 00:20:16,660 --> 00:20:21,690 in our very first cell, I'm going to keep all the import statements nice and tidy up top, 198 199 00:20:22,270 --> 00:20:35,160 I'm going to say "from matplotlib import cm", and cm stands for color map. I'm going to Shift+Enter 199 200 00:20:37,030 --> 00:20:38,150 and I'm going to scroll back down 200 201 00:20:41,140 --> 00:20:46,460 and then I'm going to modify this call to our plot surface function. 201 202 00:20:47,200 --> 00:20:53,740 This plot surface function can take some additional arguments and one of these arguments is surprise, 202 203 00:20:53,740 --> 00:20:54,700 surprise, 203 204 00:20:54,700 --> 00:20:55,830 a color map. 204 205 00:20:55,930 --> 00:20:57,920 So I'm going to say cmap 205 206 00:20:59,130 --> 00:21:00,710 is equal to, 206 207 00:21:01,020 --> 00:21:05,350 and then I'm going to use the color map module that we've just imported. 207 208 00:21:05,440 --> 00:21:09,570 So I'm going to say "cmap = cm. 208 209 00:21:09,840 --> 00:21:18,710 coolwarm". Cool warm is one of the color maps that we can use from the color map module. 209 210 00:21:18,750 --> 00:21:24,520 So let me update this chart right now by hitting Shift+Enter. 210 211 00:21:24,750 --> 00:21:25,650 There we go. 211 212 00:21:25,650 --> 00:21:27,320 Isn't that amazing? 212 213 00:21:27,330 --> 00:21:34,110 I think this is so, so cool but just like with our regular line plots and our surface plots we can actually 213 214 00:21:34,110 --> 00:21:40,230 add transparency to this plot as well. So we can go back to our plot surface call and add a comma at 214 215 00:21:40,230 --> 00:21:48,570 the end and then provide an additional argument, namely alpha equals and then say 0.4 to 215 216 00:21:48,570 --> 00:21:50,880 add some transparency. 216 217 00:21:50,880 --> 00:21:58,230 So let me hit Shift+Enter, update the chart. Now it looks like this with the alpha value at 217 218 00:21:58,230 --> 00:21:59,230 0.4 218 219 00:21:59,280 --> 00:22:05,220 we can even see our grid shining through on the back of our chart. 219 220 00:22:05,330 --> 00:22:12,210 Now personally I think this chart is starting to look quite wonderful because we've got our high cost in 220 221 00:22:12,420 --> 00:22:17,450 red and we've got our low cost in dark blue hues. 221 222 00:22:17,670 --> 00:22:21,700 So we can already visually differentiate between costs that are high and low 222 223 00:22:21,780 --> 00:22:28,320 just by looking at the color and also based on similar colors we can see which parts of our chart actually 223 224 00:22:28,320 --> 00:22:31,180 have a similar cost as well. 224 225 00:22:31,290 --> 00:22:34,690 I'm going to end this lecture on a challenge. 225 226 00:22:34,770 --> 00:22:41,970 Can you change the color mapping of this chart? I mentioned earlier that there's quite a few different 226 227 00:22:41,970 --> 00:22:47,510 color maps available and we've used one of them called coolwarm. 227 228 00:22:47,580 --> 00:22:53,660 Can you dig into the documentation and change the color map on this chart to something else? 228 229 00:22:53,790 --> 00:22:58,050 I'll give you a few seconds to pause the video before I show you how. 229 230 00:23:01,620 --> 00:23:03,620 And here's the solution. 230 231 00:23:03,960 --> 00:23:07,680 Part of becoming a proficient programmer 231 232 00:23:07,680 --> 00:23:17,320 is getting really good at googling and I'll show you two pages that you can use to give you some inspiration. 232 233 00:23:17,340 --> 00:23:23,310 So there's this one here where it's all about choosing color maps. 233 234 00:23:23,310 --> 00:23:30,070 And here you can find the names and the look of various different types of color maps. 234 235 00:23:30,090 --> 00:23:33,940 So for example one of the color maps is called plasma. 235 236 00:23:34,020 --> 00:23:42,930 So if I update my code here to "cm.plasma" then I'll get a color map that looks like this on my 236 237 00:23:42,930 --> 00:23:43,800 chart. 237 238 00:23:43,920 --> 00:23:45,930 But of course you're not limited to this. 238 239 00:23:45,960 --> 00:23:58,000 You can also try, I don't know, "winter" or "hot" see what those look like. "cm.winter" will give us this 239 240 00:23:58,000 --> 00:24:06,100 look and "cm.hot" will give us this look right here. 240 241 00:24:06,100 --> 00:24:13,870 Now if Google didn't bring you to this page then perhaps you landed on this page instead - the "colormaps_ 241 242 00:24:13,890 --> 00:24:17,490 reference.py" documentation. 242 243 00:24:17,910 --> 00:24:23,800 And here you'll also see very, very similar information - you'll get a visual representation of various 243 244 00:24:23,800 --> 00:24:27,780 different color maps that are available. 244 245 00:24:27,880 --> 00:24:33,430 So either of these two pages from matplotlib.org will give you the information that you need to 245 246 00:24:33,670 --> 00:24:36,700 find the right color map to suit your preferences.