Last active
September 24, 2015 22:36
-
-
Save thoughtpalette/115e4b04e6fa54bb722f to your computer and use it in GitHub Desktop.
Line chart in R with CSV import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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