[R] How to adjust the y-axis range in barplot properly
Luke Miller
millerlp at gmail.com
Thu Sep 22 18:15:02 CEST 2011
This should do the trick:
barplot(data, ylim=c(60,90), beside=TRUE, xpd = FALSE)
As usual, check ?barplot first for clues on how to customize the plot
to your specifications.
On Thu, Sep 22, 2011 at 11:49 AM, Benedikt Drosse <drosse at mpipz.mpg.de> wrote:
>
> Hello R-Users,
> it might be a rather simple problem I have, but I couldn't find any solution online. Thus, here is my problem:
>
> I would like to adjust the y-axis range in a barplot, since all my values are >70. Therefore I would like to only visualize the y-axis from 60-100 (example 1).
> The problem is, the range of the y-axis is adjusted, but the barsize stays the same and vanishes from the plot area.
> How can I "cut" the y-axis and the bars in a proper way. Unfortunatlely I dit not get "gap.barplot" function to work on the matrix in example 1.
>
> I would be very greatful for some ideas and help,
> cheers,
> Benedikt
>
> example 1:
> data <- as.matrix(rbind(c(85:90), c(75:80)))
> barplot(data, beside=TRUE)
> barplot(data, ylim=c(60,90), beside=TRUE)
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
--
___________________________
Luke Miller
Postdoctoral Researcher
Marine Science Center
Northeastern University
Nahant, MA
(781) 581-7370 x318
More information about the R-help
mailing list