Plotting in R is extremely easy.
plot (1:21)
![rstudio_plotting_000](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_000-294x300.jpg)
plot (1:8, main="TESTING",xlab="x",ylab="y")
![rstudio_plotting_001](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_001-300x294.jpg)
points(c(1,5),c(4,2), col="green")
![rstudio_plotting_002](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_002-300x259.jpg)
abline(h=3,col="red",lty=2)
![rstudio_plotting_003](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_003-300x259.jpg)
abline(h=1,col="yellow",lty=2)
![rstudio_plotting_004](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_004-300x288.jpg)
grid(col="purple")
![rstudio_plotting_005](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_005-300x255.jpg)
hist (1:21,col="orange")
![rstudio_plotting_006](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_006-300x257.jpg)
lines(c(2,4),c(5,3),col="blue")
![rstudio_plotting_007](http://www.tecnocracia.es/wp-content/uploads/2016/04/rstudio_plotting_007-300x276.jpg)
abline(h=3,col="red",lty=2)
Exporting and importing graphs
dev.copy(png,'myplot.png')
dev.off()
To list existing colors
> colors()
[1] "white" "aliceblue" "antiquewhite" "antiquewhite1"
[5] "antiquewhite2" "antiquewhite3" "antiquewhite4" "aquamarine"
[9] "aquamarine1" "aquamarine2" "aquamarine3" "aquamarine4"
[13] "azure" "azure1" "azure2" "azure3"
(...)
"violetred2" "violetred3"
[645] "violetred4" "wheat" "wheat1" "wheat2"
[649] "wheat3" "wheat4" "whitesmoke" "yellow"
[653] "yellow1" "yellow2" "yellow3" "yellow4"
[657] "yellowgreen"
Global changes for styles and colors
Adding texts to plots
text(11,11,"Regular text")
text(11,11, "Bigger text", cex=2)
text(5,5, "serif text", family="serif")
text(3,3 "mono text", family="mono")
text(7,7 "Sans text", family="sans")
Mathematic notation
demo(plotmath)
draw.plotmath.cell(expression(x != y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x < y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x <= y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x > y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x >= y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x %~~% y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x %=~% y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x %==% y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x %prop% y), i, nr); i <- i + 1
> draw.plotmath.cell(expression(x %~% y), i, nr); i <- i + 1