Question: R: scaling axis for different limits in hist

0

johnnytam100 •

**100**wrote:I am plotting several frequency plots using `hist`

in R.

For different plots, there is a different maximum value for the y-axis, e.g.

Plot 1:15000 as max

Plot 2: 80000 as max

However, as a different limit of the axis was set, the physical lengths of the y-axes of the two graphs were different.

I want to make the y-axis into the same physical length.

Example of my scripts:

```
hist(perc1, breaks=seq(0,100,by=0.1), ylim=c(0,15000), xlab="percentage identity")
hist(perc2, breaks=seq(0,100,by=0.1), ylim=c(0,80000), xlab="percentage identity")
```

Any idea how to modify the scripts? Thank you!

ADD COMMENT
• link
•
modified 16 months ago
by
zx8754 ♦

**9.1k**• written 16 months ago by johnnytam100 •**100**
Unlikely, the size of plots (cm/inches) depend on the viewer (pdf, png, jpeg, etc functions) size, not on axis limits, could you explain how you are getting different

"physical lengths", and what you mean by"physical lengths"?9.1kSorry for confusing by the term I used. The "physical lengths" means the height of the axis.

100If you mean you want 2 plots to be on the same scale, then maybe use the same xlim?

9.1k