Reputation: 129
I am trying to get my graph in R to change it's Y axis values. Code:
plot(tree$NUM,tree$GRA,
main="YSLOW Grades",
xlab="HAR #",
ylab="Grade",
xaxt="n")
axis(1, at = seq(1, 20, by = 1), las=2)
I have figured out how to customize the x axis, but from all my researching I cannot find a way to simply change the Y axis too. Instead of having numbers, I want to customize the graph so that I can but letter grades in like A,B,C and so on. I assume it's a quick fix to do this but I really am clueless and the material seems lacking on the subject.
To clarify, I do not want to change Y axis label or the spacing, I simply want to be able to but letters on the Y axis, regardless of the data coming into it.
Upvotes: 1
Views: 4311
Reputation: 11597
Just put yaxt = "n"
and put the new y labels with axis(2, ....)
. Example:
plot(1:20,1:20,
main="YSLOW Grades",
xlab="HAR #",
ylab="Grade",
xaxt="n",
yaxt = "n")
axis(1, at = seq(1, 20, by = 1), las=2)
axis(2, at = seq(1, 20, by = 1), label = rep(c("A", "B"), 10), las=2)
Upvotes: 1