Hi r-users,
 
I have this data below and would like to plot a barplot overlap with a line.
This is my data:
> hist_50
    pdf_obs pdf_gen.50
1  0.000000   0.000000
2  0.083156   0.125366
3  0.132196   0.158230
4  0.126866   0.149432
5  0.120469   0.127897
6  0.121535   0.104096
7  0.103412   0.082171
8  0.082090   0.063539
9  0.065032   0.048408
10 0.050107   0.036470
11 0.036247   0.027236
12 0.031983   0.020198
13 0.017058   0.014893
14 0.009595   0.010928
15 0.007463   0.007986
16 0.006397   0.005816
17 0.003198   0.004222
18 0.003198   0.003057
19 0.000000   0.002208

I tried 
sq <- seq(0,900,by=50)
sq.50 <- as.character(sq)
barplot(t(hist_50[,1]), col= "blue", beside=TRUE, ylim=c(0,0.2),
main="Observed and generated gamma sum", 
xlab="Rainfall totals(mm)",cex.axis=0.8,ylab="Probability")
legend("topright", c("observed","generated"), fill= c("blue","yellow"))
rownames(hist_50) <- sq.50
lines(spline(hist_50[,2]),lty=1)
 
The problem is the x-axis label is invisible, I want 0, 50, 100,....
Another thing is I want the line to plot on top of the barplot.  It seems that 
it is shifted to the left.
 
Thank you.



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to