Alos
Alos

Reputation: 2715

How do I adjust the y axis without messing up the x axis in r for multiple histograms?

Hi I am trying to put 7 histograms with different Y axis scales on the same plot in r. If I don't scale the images the X axis looks fine if I scale them it screws everything up. Here is what I am doing: Link to my code

I think that the problem is that I am just calling par(new=T), and that maybe there is a better way to get all of the histograms on the same x scale.
How do I adjust the y axis so that all of the histograms are on the same scale but also make sure that the scale on the x axis is the same as well? Thanks

Histograms of pixel intensity data without scaling

Histograms of pixel intensity data without scaling

Upvotes: 2

Views: 296

Answers (1)

DQdlM
DQdlM

Reputation: 10254

You should be able to force the same x-scale with xlim = c(n, p) where n and p are the minimum and maximum values of your choosing.

excerpted from ?xlim

Usage:

 plot.window(xlim, ylim, log = "", asp = NA, ...)

Arguments:

xlim, ylim: numeric vectors of length 2, giving the x and y coordinates
      ranges.

Upvotes: 4

Related Questions