[R] How to adjust the y-axis range in barplot properly

Jim Lemon jim at bitwrit.com.au
Fri Sep 23 10:28:13 CEST 2011

On 09/23/2011 01:49 AM, Benedikt Drosse 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.
Hi Benedikt,
The gap.*plot functions are intended to create a gap between two or more 
sets of values with ranges that don't overlap, such that there would be 
large empty spaces on the plot. When you just want to start the ordinate 
above zero, you can do this:


or if you really want the gap in there:



More information about the R-help mailing list