Five Tricks to Highly Effective Visualizations

Tim Shettelbauer shows five practical tricks for data visualizations: styling with plot themes, highlighting with color and 3D effects, mixing 2D and 3D graphics, controlling lighting with presets and ambient/directional light, and setting camera views. Includes concrete code tips for reproducible illustrations.
Questions this video answers
Tim Shettelbauer (Algorithms R and D team).
Style your data quickly; highlight interesting parts; build hybrid visualizations; construct simple lighting; set the best view (camera positioning).
False.
Eight base plot themes.
Automatic, Neutral, and Three-Point (the talk also references an "accent" style for single-gray-light presets).
Chapters
Hi, my name is Tim Shettelbauer and I'm part of the Algorithms R and D team. And one of my tasks is to create illustrations for the documentation. And what this talk is about is some of the tricks that I use to create some of these illustrations. And the five tricks are style your data quickly and how to highlight interesting parts of your data. Build a hybrid visualization for deeper inside of your data and show how to construct simple lighting to accent your data and to set the best view to emphasize your data. I know lighting and mystery is kind of a Lighting and camera is kind of a mystery for some people and hopefully this will help clear it up. Okay, for styling, we'll start out with something easy here. Just use plot theme and. All you do is you type in plot theme and do the rule and then you get a list of what's available and you have these eight base plot themes. And then if you click on this little arrow down at the bottom, you get several feature themes. So I'll go ahead and click on just business evaluate. I'll get the same here. And one thing you can do is you can combine themes, you can combine base theme with a feature theme and you can also add options. So what this is doing, you've got the business theme like before and then we added the wide theme. And then I'm changing the color plot style, which is just using a colored out of 112. And one tip, I've tried to include some tips in here. A lot of people wonder what, what's used in some of these plot themes. And if you use with this little bit of code here, you can type in what the plot theme is and what the visualization is and it'll give you a list of what is used. And you can kind of search through. And here's like the default plot style. And these are the colors used and the thickness and things like that. Okay, Highlight. There's different types of highlighting you can do. One is surface features and you can use color function for that. For this you gotta make. Here's the color function and I'm blending and I'm using the like at zero I want it gray. When it reaches one I want it red. And at four I want it yellow. Important thing here is you have to set color function scaling to false. If you don't, it'll just use zero to one values and it won't even show the yellow. So if you set that defaults, It'll. It'll go all the way up to yellow there. And another thing is Plot points. A lot of times you get rough textures. If the plot points are too low, you get a real rough texture. But just by increasing it, You get a nice smooth texture. Now. Another thing you do is specific area. You can highlight it by combining a visualization and graphics 3D by using the show function. Here's the actual plot and then with show I can. This is the cuboid. And one of the secrets here is to set to make a nice consistent color. You can set glow to your color and put use black too. Because if I don't do that, The light washes it out. But if you start set black here, then it will actually kind of knock the lighting out. It'll ignore it. And if you want to do more than oh, here, the highlight object, you can. If you want a some shading to it where one edges are darker than the others, you can use ambient light as the color. Another thing that's kind of interesting that I've used in few of the illustrations is adding a projection shape. And that's real easy to do. All you have to do is actually it's plotting another surface. So that's what this -15 is, you know, and you can control that to put wherever you want, you know, can move it up or move it down. And this also uses this trick of using this glow with the black. Because if you didn't do that, you wouldn't. You actually get the automatic color and I just wouldn't. It doesn't quite look right. Okay, another thing doing here is this the mesh. The default is to show the X and Y. Mesh lines. But if you just want to show contour lines, you can just here slot one shows X, slot two shows Y and slot three shows Z. So you get a nice. It kind of shows the surface off a little bit better. And here's a tip of just showing this glow color. Can you see it? Yeah. The first ball, the sphere at the very left is just a white sphere. If you give it a color, you still see the shading. But if you use glow it just colors the shading. But if you add this black to it, then you get a nice solid color. Okay. Another thing you do is hybrids or your mixing visualizations. You can combine 2D or 3D using the show function. Again, the show function options override anything that's in the visualizations or graphics. But if there are no options, like right here I have, here's, here's my first one. It's using 3D data, this is using 2D data. And so this is the 3D version of the top. This part here and then the bottom part, I'm using just a contour plot, which is the 2D data. But one thing I have, since it's 2D, I need to add another coordinate to it since it only has two coordinates. And that's what I'm doing right here. So just. Another easier way you can do this is just use epilogue or prologue for just 2D. You start with your. The main plot, which here is the slime plot. And then I'm putting bar chart, chart, prologue renders them back. So it's putting it behind the line. And but if you want it in the front, you could change that to this to epilogue and then it would render in front of the line. And one thing about this is the graphics part for whatever visualization is, when you like do bar chart, it returns graphics. And what for this you only want to use the first part of it, which you don't want all the options. You just want to use the graphic directives part of it. Okay, lighting. Lighting sometimes I think confuses people. And one thing here I'll go over lighting presets. Well, it's. This shows the four different presets we have for lighting. The automatic uses color lights in this box at the bottom. It's actually showing the. The top view of what it looks like of the position of the lights and if they're colored or gray. Automatic is uses the three color lights and that uses a gray fill and it's, let's see, accent. It uses only one gray light and it was created so for the tune shading and the gooch shading and hat shading and halftone and stipple shading because they. You can use those with multiple lights. But it gets kind of a weird effect. So we created one with just one light. Neutral is for. Created for color function because you'll notice at the top it really blows out a section here. So you really see a lot of the color that you're wanting to see. And then Three Point was one of the later ones where you have a key light and a fill light and a backlight. And those were created for the more realistic material shading colors. And for simple lighting, you just need to remember that ambient light controls the shading darkness, the directional light controls the shading direction, and then the specularity controls the actual highlight. Another thing is to use just gray lights. If you use color lights, then you got problem with them blending with the colored surface. So if you just use gray, then you have to worry about that and then your object will just show its color. And as far as the camera position, you use image scale. So it locks the light on the. With the camera. So if you rotate the object around, it also it stays in the same spot. Another thing is you need to override plot style and lighting because default. The default plot style and lighting is used. So if you don't override both of them, you, you might get some weird. It might not behave as you expect. Like, here's. So this, This is you actually using the default lighting. So you actually see some extra color in there. So you need to override it to get. If you're actually wanting like for this one, the pure, you know, blue. And then if you're using multiple colors with that, you're using the same directive here, but you're feeding it a list of colors, which. This is a list of color. It's the list of color data106 and it's putting in the slot. So it's actually creating a list of this directive. But the lighting part is the same as what was up above. Now color shading is kind of. It's a little brighter. And if you like look underneath, it's not black. Like a lot of times the looking. The underneath of plots is black. So but if you, you know, the plot style here I have set, I've used a color, but then I also give the ambient light and give it a color. And then that way all the areas that were dark are actually using the color instead of black. So it kind of makes a nicer, brighter image. And if you have multiple colors, then you can take this ambient light that was down here in lighting and you just can move it to plot, to the plot style. So even though it's light. One easy way set perspective is kind of an interesting feature of when you're plotting one way. Once you get whatever view you want, all you have to do is multiply it and you will get. You will add perspective. So the lower this number is, the more perspective it will show. But if you go too far, it's actually going to zoom in on it. But if you want an orthographic view, which I use this quite a bit just so you can visualize things much better, say just Multiply it by 10, you'll get an orthographic view, you know, and you can keep going up, but you're not gonna see much change. But there's this, the default. But if you want more, you can just multiply it like 0.6 and just a little better. And to get your views. The easiest way to do it. Instead of trying to figure out all the view functions, you can start with your graphic and then you can just drag it to rotate it to zoom. You command drag to zoom in and out. And then you can just shift drag and that will pan it to wherever you want to go. And then once you get that, you can collect the options that it set automatically. And the way I'm doing this, you can just do options and it'll give you the all the options. But if you just get the names for a few of them, it's much easier. So and then you can just take this and copy it up here. And then you've got your view saved so you don't have to sit there and figure out the view angle, viewpoint and all that kind of stuff. But if you would like to mess play around with the view functions, I created a little manipulate here. That kind of explains what each thing's doing. Showing this image on the left is the scene. But what you actually see in the window is this camera view. And what you can do like view angle, they got the six functions on the left here you can see what it's actually doing. If you notice this yellow, this is the window here, this yellow part. And then you can see that it's actually zooming it out. And then you can see what in the seam, what it's actually doing. And you can go through all six functions. And the way I set this up, you can just show the thing you're interested in. Here's this yellow rectangle is the view. It's got a couple arrows on it. Now since it's. I got view center checked. And then if I increase like the X value is going to go left and if I increase the Y, it's gonna go down. And view range, it automatically sets this one. You're generally. But if you're messing with all these view functions, you probably have set that yourself. And this kind of demonstrates how it starts to go into the object. And there's in the front and then the back, you can control it too. So if part of your image ever disappears, you can just like increase that to include so it shows your entire image. And the same way with view vector. The way I have this set up, the viewpoint actually moves as a camera. And then you can move what it's pointing at. Whoops. And one of the most difficult ones I think to visualize is the view vertical. And the view vertical is the reason. I have this black, this dark edge at the bottom. And it corresponds to the dark edge on this yellow rectangle. And you can. So you can. And you can actually rotate this around. Just kind of match the. Whoops, there it is. To match what it looks like. So. So that's kind of fun. If you're wanting to understand how all the view functions work, that kind of. This is a pretty easy way to figure it out. So. And if you want to explore more into these, you can. There's a guide graphic directives you can go to and 3D graphics options that has a bunch of the shaders and stuff if you're interested in those. So I don't know if this will let me go. Yep. Okay. Here interesting part if you're is. Oh, it's not popping up. Okay. I think it's the way because of zoom. So. But if you go to those two one, it shows like the camera but the graphics directives show shaders and stuff like that, which is very interesting. I think so. Okay, that concludes my talk. Thanks for coming.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






