So we have learned the first way on how to plot three dimensional data.
But of course, we can also generate a real 3D plot.
So for this, we just take the same arrays that we have to find here.
So the X values to Y values and the corresponding Z values that we have plotted here in terms of their
color.
But now we're going to plot them by their actual height.
And to do this, we must use these so-called Contour 3D plots.
And this is a bit tricky, I would say, because I mean, our PC screen is, of course, two dimensional
and we want to plot it in three dimensions.
So we need some kind of projection and some viewpoints, and this is exactly is exactly what we are
going to do first.
We will have to define the commands called Peltier.
So it's again enough plot lib commands and then axes.
Projection
is 3D.
So this enables us to do 3D plots.
And now I must give this one also a name.
So this will be our 3D plot.
So, yeah, I don't know.
Maybe it's called it's.
Lots.
Or projection, maybe a bit a bad name, but yeah, it doesn't really matter what we call it, just
have to remember.
And then we just write plot projection.
Don't contour 3D at now, here comes the actual plot.
So I mean, you probably guessed already what's going to come next?
The X components, the Y components, because the components, then we need some kind of know quality.
No.
And then we can also provide some color map.
And for example, we could use binary.
And this will be a plot, so you can also control the viewpoint by writing down lots of projection,
which is our name, and then the option will leave you in it and you can then provide the vector from
which you are watching.
For example, I tested this one, so now it looks a bit different.
I told you that this number controls the quality of the plots.
So for example, if you decrease it, you see basically we just add some lines here, and if we just
have 10 and we just have 10 lines.
And so, yeah, these are basically these lines.
And you can also see here it's a one to one correspondence.
So we just have one that just looks like this.
So obviously, the more lines we have to smooth out the plot looks, but also the longer it takes to
calculate it and the higher the storage capacity or the memory will be than for a simple binary like
you check what happens if we do it like this.
So then we get this colorful plot.
Maybe you like this better, but here you can provide a color map and you can Google.
The different color maps binary would be a black and white method.
All right, so we have now plotted this data in a three dimensional fashion.
Now, of course, we can also do is just to make some line and scatter plots, as we have done before,
in two dimensions.
So let me show you how this works.
It's, of course, pretty similar, but this will be the last example for the plotting that I'm going
to show you.
So since it's pretty similar to the last one, let me just go straight ahead.
I write T dot axes.
Once again, projection is 3D to enable the three dimensional plotting and this one, maybe I come up
with a better name.
Peltier three.
And all right, so now what we can do is we can we have to specify new values and maybe just go ahead
and show you what I have in mind here.
So this time I will start with the Z coordinate, which may look a bit unusual, but you hopefully will
see soon why I do this.
So in 3D, all the dimensions are have the same rights.
So to say so you don't have to define first X and Y and calculate Z.
You can also first define Z and then calculate X and Y, for example.
And this is what we're going to do here.
So once again, we have to define sound in space.
Some are basically.
And I go from zero to 30.
I tested this before.
That works quite well.
And I use 301 points then from here.
So so this is basically just a list which goes from zero down to zero point one zero point two until
it reaches 30.
Now from here, I calculate the X coordinate and the Y coordinate.
Sorry, like this.
So the X coordinate will just be a sign function
and the Y coordinate will be a cosine function.
So you see, this one is something like a circle.
But at the same time, the C coordinate that will increase linearly.
So if we can do now is we can write Patti 3D, which is our name from the for the plot.
And then just as previously we write or we wrote Contour 3D.
This time we write Plot 3D, and now we have to provide the lists for the variables.
But here we have to make sure to give them in the right order.
Otherwise, yeah, we will project in a different way.
So you see, we have to circle in the X Y plane, but in the Z direction, we have a linear dependence,
so we get this type of spiral.
So now we can play a bit with the data.
For example, I told you what happens if we choose the wrong order, then our spiral will go along to
different direction, of course.
So it's also possible.
What do you have to be careful to really get the correct thing that you want to get?
And we can also scale this, for example, to make it not a circle, but an ellipse.
So like this, and you see it still looks like a circle.
But when you look at the axes, this axis goes from minus one to one, and this from from minus two
to two.
Still, in the plots, they have the same length.
So if you want to make them really their actual length, you have to explicitly define the limits of
the plot.
So this you can do by writing down plots, dots x limb and then also plot toward the y limb.
And now we must provide the same numbers here, and I take two.
Now you see, it's an ellipse, so there's oval shape instead of the round circular shape that we have
before.
So now let me show you another thing that's possible.
Let me just copy this.
And this time, instead of using plot three d, we use Scatter 3D.
So this is really the same thing as we did in two dimensions, but this one gave us a smooth line as
here.
And this one gave us individual data points.
So here you see all of these points, and especially if I decrease the number or the range, and you
will see that it's not actual smooth, but they are really individual points that you can plot.
And as always, you can combine several plots so you could combine this one and this one.
All right.
So in our plotting lecture, we have started from two dimensional data where we have created a scatterplot
which are individual data points.
Then we have created these line plots, which you can do by writing down field dot plots.
Then we have come to three dimensional data, which you can visualize using density or contour plots,
where the third dimension is basically encoded by the color as hero here.
Or you can go to real three dimensional plots where you have such a surface three dimensional space.
Or you can even have some like parametric plots where you have a line or even individual data points
in three dimensional space.