
Brett Champion walks through new Wolfram Language visualization tools: AbsoluteOptions fixes, VectorDisplacementPlot for deforming shapes to show vector fields, TernaryPlot for three-component data like mineral composition or nutrition, and expanded scaling functions including infinite and date scales.
Chapters
Hello, welcome. My name is Brett Champion, I'm the manager for the visualization team here at Wolfram Research and we have a track of talks that is going to close us out for the day. So I will be talking first about general overview of some of the things we've been working on over the past year and released over the past year. Then Tim Shuttlebauer is going to give a talk about some tips and tricks and guides for creating visualizations. Then I'm going to give another talk about multi panel visualization. And then Min has said he's giving a two hour long presentation on scales and stuff. So we'll go ahead and get started and we'll see how much of my notebook I get through topics, absolute options, vector visualization, ternary plots, scaling, expansions, and kind of ignore the plot styling there I'm not going to have time for it. So I didn't even write the slides. So if you were at Yutzu's talk earlier this morning, early this morning, one of the things that has been worked on Starting in version 13 and some additional work I went into it for 13.1 is an overhaul of absolute options. So if you had used or attempted to use absolute options in the past, you probably noticed that there were situations in which it would, well, lie to you about what settings the graphic was actually using. And so here I have a scene with a bunch of colored squares and we can see that the axes frame really goes from about minus 200 to 200 in each direction. And if we were to ask in version 12.3 what the plot range was, what the aspect ratio was, image padding, frame ticks. It would claim that the aspect, that the plot range was 0 to 1 in both directions and the aspect ratio is one that's reasonably accurate. Image padding. It just kind of left us all. We don't know how much padding it has. And for people who perhaps aren't deep into how graphics work in the Wolfram language, the image padding is the portion of this graphic that is outside the black square but inside the orange one. So basically all the space that's necessary to draw those frame ticks, the labels for the frame ticks. And so previously absolute options was like image padding was all which at least for my purposes, isn't very useful. And then the frame ticks are a bunch of numbers corresponding to it. Thinking that the plot range was 0 to 1 in both directions. If we look at a newer version, version 13, and we ask the same information, we get plot ranges that are basically about minus 200 to 200 in each direction. The aspect ratio is not quite one. It's a little bit over corresponding to the more accurate plot range. We have actual numbers for the image padding. And so this is 26 points on the left and 1.4 on the right and 15 on the bottom and 0.5 on the top. And then the frame ticks are numbers that actually correspond to ticks that go from minus 200 to 200. And so this is a much more reliable thing to work with now in the cases where you're building things up and you want to know what the settings of a graphic actually are. That being said, it hasn't necessarily been implemented for every graphics option. We've started at the ones that are most important to us. In fact, the ones that I need most for implementing multi panel plots. And so if you come across options where absolute options you feel isn't giving you the information that it should, please let us know and we'll add it to the list for implementation. So moving on to vector visualization in version 13.0, I think at this point the versions all run together, we added vector displacement plots. And so these are a way of visualizing a vector field by seeing how it works on an object, how it transforms an object. And so here we have a constant vector field, which is just one, one. So go, go up and go to the right and we're plotting it over a disk. And what we see is the effect of this vector field. And let me is we're starting with our actual disk, which is centered at 0, 0 with radius 1, and that's sort of ghosted in as a background element. And then we look at the displacement plot, which is a representation of that disk being shifted up to the right. By default, it's not being shifted up by one and over by one, because we want something that is able to work for both really large effects and very small effects. So in a lot of the finite element type methods, you're looking at very small deformations of the object. And so we want to be able to exaggerate it so it's easier to see what the effect is. And the fact that this disk is blue, just a constant blue, is because it's a constant vector field. So here we have a more interesting example. So it's a somewhat random vector field I made up with cosines and sines and whatever. And we're going to apply it to an annulus. And so we still have the gray annulus in the background. And now the annulus is getting warped and distorted in more interesting ways. And the direction of the distortion is proportionate to the direction of the vector field. And the coloring of the distorted annulus corresponds to the magnitude of the distortion. And so the bottom left corner, which is sort of that bluish, is the smallest amount of displacement. And then in the top right corner, where we have the brightest yellow, that is the largest displacement in terms of distance. And we can turn on if we, we can set vector points, goes to automatic. And this is going to show basically the vector plot corresponding to this. And so we see the arrows that correspond to the deformation all over that region that we're looking at. And so a couple of examples of this that are more applied. So these are, I'm not including all of the code for these in this notebook. There's a link here to the documentation where these examples are done in sort of their full glory and fully derived and worked out. But to summarize, in this case we have an L shaped object and it's being fixed solid at the bottom here at the base. And we're applying a, we're pulling to the right on the top portion of that L and we can see sort of what, what the effect of the deformation is. And here we have a legend that gives an idea of what the magnitudes are for how much that deformation is occurring. And in this case we're instead of coloring by the magnitude of the vector field, we are coloring by von Mises stress, which is computed in the full example in the documentation. And you can sort of see where the highest stress points are and where the least where the, these stresses. And then, you know, probably one of the examples that's used the most, and again this is pulled mostly from the documentation is we have a spoon and we're going to set up various conditions on various forces on it and look at the displacement. And so with the spoon being fixed, you know, held at a fixed point at the, well, the non business end of the spoon, I should, I guess is the least deformation. And then you can sort of see where it's being pulled down with the portion that you would eat with or scoop with. So the next thing we're going to look at is ternary plots. These were added in 13.1, I believe. And the basic idea for ternary plots is that these are a way to visualize a mixture of three elements as a 2D plot. And because it's a mixture, we have a constraint that everything adds up to. All the components add up to 100% and we're going to use that to reduce the dimension, basically solve for one of the variables. And so what happens here is then we get three axes, A, U, V and W axis. And so the U axis is going to go from zero to one W, sorry, V is going to go from zero to one along this edge, and W is going to go from 0 to 1 along the left edge of the triangle. And a point in the middle is going to correspond to basically a normalization of the values. And I will go ahead and mention that we do the normalization so you don't have to pre set up that all of your data adds up to one. So if you have, you're measuring something, you have three elements and the total masses of the things are different across the different samples. That's fine, as long as you know what the individual masses are or the individual quantities. And so we'll take a quick look at some of the constant, some, some of the lines that occur in ternary plots. So here we have lines that are sort of parallel to this axis. And so what these are going to correspond to is these are like this blue line, the longest one corresponds to anything, any element that is 10% component A. So a is along this bottom axis. And everything along here corresponds to 10% at point one and so on. And then going around, you get lines going in other directions. The other type of lines that you can get are lines that go into a vertex. And so in this case, each of these lines is a fixed ratio between two of the components. So this blue line that's on top of all the others corresponds to all samples where Component B is 10 times what component C is. And so, you know, and it may be, you know, so at this point here at the end, where it meets the C axis, that corresponds to 0% component A, and then a 10 to 1 ratio of everything else. And then say over here, you're looking at something where it's 50% component A and B is 10 times what C is. And so those are a couple of the lines that you can look at and sort of read off a fixed ratio or a fixed percentage on a ternary plot. So here we have some quick examples. The first is A comes from geology, which has used this very heavily in the past because they will take a soil sample and classify it as it's 27% sand and whatever percent silt and clay. And here we have added a prologue to sort of draw regions in the background. And the United States Geological Survey actually has somewhat standardized these regions and so I'm not a geologist, but each of these regions has names for different types of soil that may be important to somebody who's in agriculture or maybe in mining or water hydrology, sorts of applications where they want to know how fast is water going to drain, how stable is it going to be under whatever conditions. And then there's a few other examples that we've sort of come across. And really I think these are interesting plots for anything where you have a mixture of three things. So here we're looking at nutrition, we're looking at various foods and what their proportions of how much fats they provide, how much carbs they provide, how much protein they're providing. And so along the bottom edge here, okay, this point is salt. I think it's zero for all three of those things and it's just ending up in the corner here. But so here we have some roast beef, more beef with some bacon added. You know, this is basically our protein, high amount of protein. Well, I mean high amount of fats, a varying amount of fat and protein is this axis. So lots of protein, lots of fat and then different things in other corners, whatnot. We also have I think, this interesting example showing energy sources for countries around the world. And so is it coming from fossil fuels, is it coming from renewable resources, is it coming from nuclear? Basically all these points along the bottom, all these countries along the bottom are countries that are not using any nuclear energy for their sources. We have France which is using lots of nuclear and there's a few countries that are heavily into renewables. Zambia for example gets the vast majority of their electricity from Hydro, for example. They're down here in this all renewables all the time corner. The next thing we're going to look at is some expansions we've done in terms of scaling functions. Min is going to look at, look at this in more detail. But I think mostly disjoint from what I'm covering. So the first thing that we added was in role is in expanding our support for scaling functions is being able to have infinite scales. And so here we have a function and I'm plotting it from 1 to 100 and we kind of see what the behavior is. And I could bump it up to 1000 and see a bit more of it. But now what we can do is I can actually put infinity as one of the limits or minus infinity and positive infinity as both limits and do the plot and it's going to switch over to a scaling function that allows us to get closer to infinity. I'm not going to guarantee that we sample exactly at infinity. The function is probably undefined there, but we'll get closer, you get out farther, faster. I'll say we can see the decrease a little bit more plainly, a little bit more clearly. Then we're looking at it on a regular linear scale. Where in some of these cases like did it flatten out? Is it still decreasing or converging to a value? Not sure. We can also explicitly set scaling functions to infinite. And so one case where you might do this is when you're using the auto infinite scale on the X direction in a plot to also set the infinite scale for the Y direction. Depending on the function you're using, it may be bounded, it may not. And since we aren't auto detecting that yet, you may want to automatically, I mean, you may want to manually switch to an infinite scale in one dimension or another. So in this case we're using infinite for both. And because were dominated by that X term, this does a better job of showing that it looks roughly like a plot of X, whereas if we don't specify that the vertical scale should be an infinite scale, we get some distortion because we're using a finite scale for the vertical axis. I'm not sure you can set plot range to infinities. It should get scaled, okay, but it will only get scaled if you're, if you've set scaling functions goes to infinity. So it's not going to auto detect that you set the plot range to infinities and invoke the scaling function. And so this has been hooked up for many of the functions, not necessarily all of them, but all. Well, I shouldn't say all, but at least the vast majority of the function type visualization plots. And let's see, then we have one more slide left. And then the other thing that we've automated and built into things a little bit more is support for date scales. And so if you have time series, you should be able to feed these into a lot of the data visualization functions and have them automatically detect that, oh, it's a time series. I'm going to use a date scale without having to necessarily use date list plot or date list log plot or whatever. And so here we have list line plot 3D for 4 cities using data from the beginning period of time at the beginning of this year. And we can see what the temperatures were for the first week of January in Champaign and London and Miami and Cape Town. And we can sort of see this, as you know, in this line plot 3d and if your data is not in a time series object, then we're probably going to need some help to know to convert into that scaling function. So we have scaling functions goes to date. And so here is a plot I didn't make bigger. This is an example I try anytime we make improvements to the VIZ functions, especially list plot, which is sort of for champagne. Over the course of the year, what is the sunrise, when is sunrise and when does sunset? And so because I'm using a data axis and I'm jumping through a little bit of hoops to convert the sunrise to just a time object without the date, then we actually have sort of a normal date axis along the X axis, which, okay, yeah, we've had that for a long time. But we also have a date axis along the Y axis which is showing us sort of over the course of the day when we have sunrise, when we have sunset. So unfortunately we're in October now and so we're in the narrowing part of daylight and we get less of it each day, but by the end of the year sunset at least we'll start getting later. So that's good. And so in most cases scaling functions goes to date should be sufficient. But if it's not, there is a date scale more verbose thing that allows you to say how do I want the ticks to be formatted, how do I want to interpret the dates? So here we have our data is some sort of string, month, day, maybe day, month form and a height. And so date function is saying that we're going to interpret this as day, month. If I swap the input in that specification, then it becomes monthday. The curve looks the same, but the axis is different and interpretation is different. And then also we can use date ticks format to change how the ticks get formatted along that axis, sort of. However, date takes format. I mean it has its own documentation and you can sort of build up what you want the stuff to look like. And I think that concludes everything I wanted to talk about.
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






