[R] Distribution hist

bgnumis bgnum bgnumis at gmail.com
Tue Oct 27 21:17:20 CET 2015


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]]



More information about the R-help mailing list