Welcome to Code Sharer, a code gallery for creating, saving and sharing all kinds of code snippets.

Snip Code Type — R 9 results found

Plotting a basic graph in R from a ASCII file R 474
Author: Ryan Bradley-Evans (Admin) Posted On: Sunday, November 2, 2014 at 5:01 AM

test.dat is the name of the ASCII saved in the working directory.

common graph types are; "p" for points, "l" for lines, "b" for both, "c" for the lines part alone of "b", "o" for both ?overplotted?, "h" for ?histogram? like (or ?high-density?) vertical lines, "s" for stair steps, "n" for no plotting.




Simple Graph Plotting R 350
Author: Matt Posted On: Monday, November 3, 2014 at 9:30 PM


This is just a simple introduction to plotting graphs in R.





'type="l"' = line plot graph type

'xlab' and 'ylab' = x and y labels


'main' = title of graph

Regression line R 378
Author: Ryan Bradley-Evans (Admin) Posted On: Thursday, November 27, 2014 at 6:44 PM

Plot a regression line in R and print the summary of the regression line.





Error bars. R 333
Author: Ryan Bradley-Evans (Admin) Posted On: Friday, November 28, 2014 at 2:12 AM

Plot error bars for both x and y in R 

Heart Graph R 529
Author: Ryan Bradley-Evans (Admin) Posted On: Tuesday, December 2, 2014 at 11:27 AM

"lwd" is the width of the line
Heart R plot

Christmas Tree R 421
Author: Ryan Bradley-Evans (Admin) Posted On: Tuesday, December 2, 2014 at 11:54 AM

Plots a Christmas tree with decorations in random places along the branches. try running the same code a few times to see for your self!


xmas tree





Save a graph as a pdf R 179
Author: Ryan Bradley-Evans (Admin) Posted On: Wednesday, December 14, 2016 at 7:46 AM

Insert you functions/datasets for X and Y after X<- and Y<- respectively 

Fractal Tree R 280
Author: Ryan Bradley-Evans (Admin) Posted On: Monday, August 21, 2017 at 2:43 PM


Fractal Tree

Barnsley’s Fern Fractal R 342
Author: Ryan Bradley-Evans (Admin) Posted On: Tuesday, August 22, 2017 at 10:11 AM


Fractal Tree