R Tutorial. Part 2.3: van der Pol Equation

In this chapter, we discuss three dimensional plotting with R. To view a plot in 3d, we can use the cran package plotly. Plotly is great because the graph is interactive, but its three dimensional plotting capabilities are limited. To see other plotly 3d capabilites: https://plot.ly/r/3d-charts/

lattice is a great R package for multivariate data plotting. To plot a 3d surface function, we can use the function "wireframe." This function produces a plot (unlike plot_ly, which produces an interactive graph).

 

Example: The paraboloid example shows that any function with three variables can be visually represented using the plot and plotly functions.

Next, we utilize anothe rpackage plotly for creating interactive web-based graphs via the open source JavaScript:

Rgl is another package that is useful for 3d plotting. It is interactive; however, mac users must download XQuartz to use the rgl package: https://www.xquartz.org
     ■

 

Example: We plot a torus with the follwoing commands:

     ■
For 3D Visualization is very helpful to use package rgl.

 

Example:

Another code:
     ■

 

The package lattice can also be used to a plot parametric functions
b<-matrix(c(2,2,2,4,4,4,6,6,6),nrow=3,ncol=3,byrow=TRUE)
b
     [,1] [,2] [,3]
[1,]    2    2    2
[2,]    4    4    4
[3,]    6    6    6

 

  1. https://cran.r-project.org/web/packages/deSolve/vignettes/deSolve.pdf
  2. King, A.A., Ordinary differential equations in R, 2018, https://kinglab.eeb.lsa.umich.edu/480/nls/de.html
  3. Soeraert, K., Cash, J., Mazzia, F., Solving differential equations in R, Springer, 2012.
  4. Soetaert, K., Petzoldt, T., and Woodrow, R., Solving Differential Equations in R, The R Journal, Vol. 2/2, December 2010, pp. 5--
  5. https://www.lehigh.edu/~wes1/R_PDE/R-Matlab_compare.pdf