[R] barplot with some 0 frequencies

David Winsemius dwinsemius at comcast.net
Fri Oct 5 08:58:58 CEST 2012


On Oct 4, 2012, at 9:05 PM, David Winsemius wrote:

> 
> On Oct 4, 2012, at 4:49 PM, Guillaume2883 wrote:
> 
>> Hi all,
>> 
>> I am back with a new question !
>> I recorded the occurence of 4 differents event on 20 places for a given time
>> period.
>> Now, I want to do some barplot of the frequency of theses events for each
>> place, so it should be easy. My problem is that I want to see the
>> frequencies of the 4 events on my barplots even if the frequency of some of
>> them is 0. 
>> How could I do that ?
>> 
> 
> Put a big zero on the axis?

barchart(abs(-3:3) ~ letters[1:7], origin=0)

require(grid)
trellis.focus("panel", 1,1)
 grid.text(label=paste("0"),
                     x = convertX(unit(4, "native"), "npc"),
                     y = convertY(unit(0, "native"), "npc")
                     )
 trellis.unfocus()

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list