Something like this might help you get started.
Simulation <-
c(10403, NA, NA, NA, NA, 11178, NA, NA, NA, NA, 11521, NA, NA,
NA, NA, 11385, NA, NA, NA, NA, 10102, NA, NA, NA, NA, 10544.013,
10339.925, 9912.695, 9928.198, 9932.112, 9008.05, 9437.174, 10406.784,
10832.123, 11095.868, 10955.094, 10804.075, 9002.848, 11276.038,
10503.487, 11899.525, 10085.509, 9109.918, 8953.339, 10135.833,
11047.832, 14353.462, 8804.653, 11942.829, 7722.255, 9732.114,
8413.027, 10213.796, 10091.471, 12317.169)
yl <- c(0, 20000)
par(mfrow=c(1, 2), oma=c(0, 0, 2, 0))
matplot(Simulation, type="l", ylim=yl)
fhist <- hist(Simulation, plot=FALSE)
with(fhist, plot(counts, mids, ylim=yl, type="o"))
mtext("Dim Mo Simulation 2 years", outer=TRUE, side=3)
Jean
On Tue, Oct 27, 2015 at 3:17 PM, bgnumis bgnum <bgnumis at gmail.com>
wrote:
> Hi all,
>
> I have this data on "sim" variable
>
> 10403.000 NA NA NA NA
> 11178.000 NA NA NA NA
> 11521.000 NA NA NA NA
> 11385.000 NA NA NA NA
> 10102.000 NA NA NA NA
> 10544.013 10339.925 9912.695 9928.198 9932.112
> 9008.050 9437.174 10406.784 10832.123 11095.868
> 10955.094 10804.075 9002.848 11276.038 10503.487
> 11899.525 10085.509 9109.918 8953.339 10135.833
> 11047.832 14353.462 8804.653 11942.829 7722.255
> 9732.114 8413.027 10213.796 10091.471 12317.169
>
> I want to use matplot on a left plot and a "distribution line" on
a right
> plot.
>
> My idea is the same size from the ylim (max and min) on the left plot will
> be the same on the right plot (but I cannot get the same size so thar the
> right plot show the distribution of the matplot on the left.
>
> I tried this but canot (some suggest me using rect() for the boundaries of
> the second plot but I cannot achive what I want.
>
> I dont care if is it a hist or line plot but something similar a
> distribution shape (or like a bell)
>
>
> Can anyone try to help me?
>
> par(mar=c(10,6,6,6))
> matplot(Simulation,type="l",ylim=c(0,20000))
>
>
> title(" Dim Mo Simulation 2 years",font=4)
> fhist<-hist(Simulation,plot=FALSE)
>
> par(mar=c(6,0,6,6))
> barplot(fhist$counts,axes=FALSE,
space=0,horiz=TRUE,col="lightgray")
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
[[alternative HTML version deleted]]