R is a statistical analyzation language, and that means it is very good at data manipulation and data analyzation. One key way to analyze data is through plotting, and R excels in this field. R provides a variety of plotting capabilities. The basic command is plot: In this chapter, we discuss some techniques for manipulating with graphs that will be useful for presenting solutions to the initial value problems:
Our first example starts with discrete plot. R will take two vectors, x and y, of the same length, and will plot them against each other. For example,
When a function is defined by an analytic formula involving functions that R knows, we can make a simple graph. This is using R's built-in plot function to plot a 2d function. In R, you cannot plot a function without first creating points and applying the function to the points. The plot function will plot these points as a scatterplot. To plot a continuous line, specify type = "l"
We can change the width of the curve and add a text as the following example shows
Instead of line, we can use circles:
It is possible to plot multiple functions on the same graph, plot the first function and call "lines" for every additional function, which adds each function to the original plot.