Now let's start with some simple plotting.
First of all, let's just create some values to play with.
We going to use the range function,
in these arguments we're going to pass the range values one to five.
If I don't specify size remember it will use the counting values or
integer values so one, two, three, four, and five.
So pick from those elements one, two, three, four, five, five values for me.
And we're going to put that in the computer variable called, xvals.
And there we go we have a five element array which is the column vector
here of 64 bit integer elements, 3, 1, 5, 5, 3.
Every time you run this you're going to get something else.
Let's also create, by the same process, an array of values called y values.
And as I say, we haven't see that the own number generator you're going to get
different values.
Now let's plot these as a scatter plot.
So it's going to take the value three on the x-axis and
then the value three on the y-axis and use a point.
And then it will take x-axis value one, and the y-axis value four, and pluck that.
So here we go, we're just going to say plot and
then we have to refer to these two arrays and that is called the aesthetics.
These values that you pass that will actually be used to create the plot,
those are called aesthetics.
And we take two arguments, x and y.
So x is going to be my array of xvals and
y is going to be my array of yvals and we can plot that to the screen.
Now what you'll notice is some compilation has to take
place invoking the spot function that code has to be compiled so
that it is going to take awhile, depending on the speed of your machine
to have that first block executed if you use the plot function.
Later on you will see the execution
becomes quicker because we've already had compiling of that code.
So there we go remember we had a value of 3 on the x axis and
here we had a 3.0 on the y axis.
And it's going to plot these are, going to do it's best to arrange those values for
you on that plot.
Now these are point markers.
If we go down that is referred to as the geometry lines, points, etc.
And if we don't specify anything and we pass to erase as our aesthetics,
it is going to use the point geometry as it's default but
we can also specify that as an argument value.
And the way to do that is GEOM, short for geometry.point.
So if I were to run that, we're going to get exactly the same thing back.
We're going to have these values plotted as a scatter plot.
You would recognize this as a scatter plot.
Now difficult to see on the screen these marks are quite small.
The color of this, this default color is called deep sky blue and
we'll look at all of this things.
Let's just create something with a few more data point values.
I'm going to create xvals two and yvals two, two computer variables.
They're going to both be fold as arrays of 100 elements each taking values,
integer values in the range from zero through 100 and we're going to plot those.
x and y are static but
this time we're going to call a function on the raise in themselves.
Sort, we'll just sort them, we haven't done anything else so
it's just going to be in ascending order.
So we're going to sort both of those and then create the scatter plot.
And now you're going to see all our little data point values
from zero to 100 both on the x and y axis.
And those are plotted nicely as geom.point geometry.