[R] Scope of Axes

Jim Lemon drjimlemon at gmail.com
Tue Oct 20 23:56:45 CEST 2015


Hi bgnumis,
I'm too lazy to try to work out what "Simulation" contains, but try this:

Simulation<-sin(seq(0,6*pi,length.out=144))*5000+
 2000*runif(144)+seq(8000,5000,length.out=144)
png("bb.png",width=800,height=400)
par(mfrow=c(1,2))
plot(Simulation,type="l",ylim=c(0,20000))
abline(h = 0, lwd = 2, col = "black")
fhist<-hist(Simulation,breaks=seq(0,20000,by=2000),plot=FALSE)
barplot(fhist$counts,axes=FALSE, space=0,horiz=TRUE,col="lightgray")
dev.off()

Jim


On Wed, Oct 21, 2015 at 3:27 AM, bgnumis bgnum <bgnumis at gmail.com> wrote:

> Hi all,
>
> I want to plot two graphs and I use this :
>
> par(mar=c(10,6,6,6))
> matplot(Simulation,type="l")
>
> abline(h = 0, lwd = 2, col = "black")
>
> fhist<-hist(Simulation,plot=FALSE)
> par(mar=c(6,0,6,6))
> barplot(fhist$counts,axes=FALSE, space=0,horiz=TRUE,col="lightgray")
>
>
> The question is, that the legth of the hist plot is not equilibrated with
> the main plot so the fhist is not achiving the goal I´m looking so that it
> happens what I attach in png, it seems that the right plot is central value
> is below the value of the simulation. How can I ensure that de max min in
> the left is the same that in the right (second) plot?
>
> ______________________________________________
> 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]]



More information about the R-help mailing list