Skip to content

Instantly share code, notes, and snippets.

@thoughtpalette
Last active September 24, 2015 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoughtpalette/115e4b04e6fa54bb722f to your computer and use it in GitHub Desktop.
Save thoughtpalette/115e4b04e6fa54bb722f to your computer and use it in GitHub Desktop.
Line chart in R with CSV import
library(ggplot2)
# Import CSV file, Use default headers, comma delimited
fuck <- read.csv2("Caitlins.csv", header=T, sep=",")
# Assign cats (categories) to first row (x) Which is sample name
cats <- fuck$X;
# x axis(?)
markers <- 1:25
# no fucking idea
ot <- matrix(runif(length(cats)*25), length(cats), 25)
# Line colors
colors <- c("green", "blue", "cyan", "yellow", "magenta", "orange", "red", "black")
#plot
matplot(1:25, t(ot), type="l", lty=1, col=colors, pch=markers, bty="n", las=1, xlab="# of Sequences", ylab="# of Observed Species", main="Rarefaction Curve")
# Trying to set yAxis values to var
yAxis <- seq(from=20, to=100, by=20)
# Assigning var to axis() method
axis(2, at=yAxis, labels=yAxis)
# Create legend with Categrie names
legend("topright", col=colors, cats, bg="white", lwd=1, pch=markers, legend=cats)
# Surround chart with box
box()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment