1 / 13

Creating Graphs in R

Creating Graphs in R. Graphing techniques Sharon style! (I am not sure if this is a good or bad thing but this is what I do...). Basic graphical tools that I use. lines(x, y, lty = “solid”, lwd = 1) points(x , y, pch = 16, cex = 1) arrows( x0, y0, x1, y1, length, angle, code )

cathycruz
Download Presentation

Creating Graphs in R

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating Graphs in R Graphing techniques Sharon style! (I am not sure if this is a good or bad thing but this is what I do...)

  2. Basic graphical tools that I use... • lines(x, y, lty = “solid”, lwd = 1) • points(x , y, pch = 16, cex = 1) • arrows(x0, y0, x1, y1, length, angle, code) • text(x, y, labels, adj) • mtext(text, side, line) • axis(side, at, labels)

  3. lines() • This function is used to add lines to existing graphs. • The different line types are:

  4. points() • This function is used to add points to existing graphs. • Some of the different points are:

  5. arrows() • code= argument specifies which ends of the arrows have an arrow head. • code=1 produces a head at the start of arrow, • code=2 produces a head at the end of the arrow • code=3 produces a head at both ends.

  6. text() • text() draws the strings (text) given in the vector labels at the coordinates given by x and y • Can be added to any part of the graph

  7. mtext() Text is written in one of the four margins of the current figure region or one of the outer margins of the device region.

  8. Elements of the graph • lines • points • arrows • text • mtext • axis

  9. axis() • This function give you control over the axis labels. • I use this to add the labels etc that I want on the graph rather than using the default labels etc.

  10. adj

  11. The graph that provided the inspiration

  12. The most important thing... • Plan the process. • Prepare your data. • Work through getting one step correct before moving to the next step. • Don’t get overwhelmed by trying to do everything at once. • If you don’t succeed – try, try, try, try... again!

  13. Useful links... • http://users.monash.edu.au/~murray/AIMS-R-users/ws/ws11.html • https://www.stat.auckland.ac.nz/~ihaka/120/Notes/ch03.pdf • www.zoologi.su.se/education/courseweb/statistics/Pimp_Your_Graph.pdf

More Related