I'm trying to plot data from several columns of a dataframe. Each column represents the y value and for each of those, the x-value range from 0 to 100. When trying to graph this data, they y-axis looks like a giant mess(there are 12 columns). If I can set a minimum y value of 0 and a max of 1700 or so, things should workout. How do I do this? Also how do I extend the x axis so that I may add a legend next to it(How do I do that here?) ggplot is not being recognized by my Rstudio so I used this code
plot(x-axis, y1)
par(new=T)
plot(x-axis, y2, col="darkcyan")
par(new=T)
plot(x-axis, y3, col="green")
par(new=T)
plot(x-axis, y4, col="orange")
par(new=T)
...
plot(x-axis, y12, col="blue")
par(new=T)
I also wrote this other code to do the same thing.
matplot(x-axis,
cbind(aaaa,aaab,aaac,aaad,aaae,aaaf,aaag,aaah,
aaai,aaaj, aaak,aaal),type="l",col=c("red", "blue",
"green", "cyan", "darkcyan", "azure",
"darkkhaki","aquamarine", "brown1","deeppink",
"deepskyblue1", "blueviolet"), xlab="Return Period
(Years)", ylab="Return Years (mm)" )
legend("topright", colnames(dfreturnplot2), col=12,
cex=0.8, fill=seq_len(12))
Here, the y-axis looks fine but legend is interfering with the visibility of the graph. I can't just make a longer x-dimension by lengthening x-axis so what I should do?
After following Jay's advice, I now get
Is there a way to make the screen bigger so someone looking at this can see what's going? Is there an alpha value like in python so that we can see through a curve that's on top of several others?
After using Jay's second suggestion, I get (I still have to read the link he provided)
I also looked at using ggplot2. Using this code:
How do I add a legend to this. I feel like it should be very easy but I'm missing something and Evans answer is a bit confusing for me right now. Is there a way to add a label right after the color?
I don't see a parameter within geompoint that I can use to add a label to the curves individually. Am I missing something?