[R] dotchart to barplots

Nair, Murlidharan T mnair at iusb.edu
Wed Sep 23 22:01:27 CEST 2009


Thanks Peter. Where did you find  that option? It's really cool
Cheers../Murli


-----Original Message-----
From: Peter Ehlers [mailto:ehlers at ucalgary.ca] 
Sent: Wednesday, September 23, 2009 3:56 PM
To: Nair, Murlidharan T
Cc: r-help at r-project.org
Subject: Re: [R] dotchart to barplots

Murli,

Two points:
1. I think you might want las=1;
2. have a look at the density= argument,
i.e. add density=c(10,20,30,40) to your call.

Peter Ehlers

Henrique Dallazuanna wrote:
> Perhaps a white border:
> 
> barplot(t(as.matrix(intersect.data[,2:5])),
>          border = 'white',
>          beside = T, horiz = T, legend.text = names(intersect.data)[-1],
>          names.arg = intersect.data[,1], cex.axis = 0.7, cex.names = 0.7, las=2)
> 
> Or you can use the 'col'  argument to select further colors.
> 
> 
> On Wed, Sep 23, 2009 at 4:35 PM, Nair, Murlidharan T <mnair at iusb.edu> wrote:
>> What I mean by design is a black and white lines or something that is more distinguishing than the grey levels?
>> Thanks for the legends :)
>> Cheers../Murli
>>
>>
>> -----Original Message-----
>> From: Henrique Dallazuanna [mailto:wwwhsd at gmail.com]
>> Sent: Wednesday, September 23, 2009 3:32 PM
>> To: Nair, Murlidharan T
>> Cc: r-help at r-project.org
>> Subject: Re: [R] dotchart to barplots
>>
>> Sorry, byt what you mean by 'designs'?
>>
>> You can add a legend with:
>>
>> barplot(t(as.matrix(intersect.data[,2:5])),
>>         beside = T, horiz = T, legend.text = names(intersect.data)[-1],
>>         names.arg = intersect.data[,1], cex.axis = 0.7, cex.names = 0.7, las=2)
>>
>>
>> On Wed, Sep 23, 2009 at 4:26 PM, Nair, Murlidharan T <mnair at iusb.edu> wrote:
>>> Ok, I could make it perpendicular by specifying las=2
>>>
>>> barplot(t(as.matrix(intersect.data[,2:5])),
>>>          beside = T, horiz = T,
>>>          names.arg = intersect.data[,1], cex.axis = 0.7, cex.names = 0.7, las=2)
>>>
>>> Still working on the other though.
>>> Cheers../Murli
>>>
>>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Nair, Murlidharan T
>>> Sent: Wednesday, September 23, 2009 3:21 PM
>>> To: Henrique Dallazuanna
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] dotchart to barplots
>>>
>>> I had tried names.arg=c(intersect.data[,1]) so that was the problem. That solves part of what need. I there a way to rotate how it is written on the y-axis?  Also, use designs instead of gray scale and making keys for it?
>>> Thanks for chipping in.
>>> Cheers../Murli
>>>
>>>
>>> -----Original Message-----
>>> From: Henrique Dallazuanna [mailto:wwwhsd at gmail.com]
>>> Sent: Wednesday, September 23, 2009 3:09 PM
>>> To: Nair, Murlidharan T
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] dotchart to barplots
>>>
>>> Try this:
>>>
>>> barplot(t(as.matrix(intersect.data[,2:5])),
>>>          beside = T, horiz = T,
>>>          names.arg = intersect.data[,1], cex.axis = 0.7, cex.names = 0.7)
>>>
>>> On Wed, Sep 23, 2009 at 4:01 PM, Nair, Murlidharan T <mnair at iusb.edu> wrote:
>>>> Hi,
>>>>
>>>> I am trying to plot the following data so that it can be visually represented well. I tried the dotchart but I felt it was too spread out. Then I tried the barplot which is good enough for me. Is there a way to give the labels for the y-axis as in the dot chart? Also, I feel the grey level is confusing, so is there options for designs within the bars? I cannot use color as the journal wants it in black and white.  I also need to specify the key. If someone has done it, I would appreciate your input.
>>>> Cheers../Murli
>>>>
>>>>
>>>> intersect.data<-structure(list(X = structure(c(1L, 3L, 8L, 9L, 10L, 11L, 12L,
>>>> 13L, 14L, 15L, 2L, 4L, 5L, 6L, 7L), .Label = c("1-100", "1001-1100",
>>>> "101-200", "1101-1200", "1201-1300", "1301-1400", "1401-1532",
>>>> "201-300", "301-400", "401-500", "501-600", "601-700", "701-800",
>>>> "801-900", "901-1000"), class = "factor"), MCM.Cell.vs.MCM.Tumor = c(6L,
>>>> 7L, 12L, 9L, 13L, 7L, 11L, 4L, 8L, 11L, 11L, 12L, 4L, 15L, 28L
>>>> ), Ttest.Tumor.vs.Ttest.Cell = c(4L, 2L, 7L, 9L, 8L, 10L, 4L,
>>>> 7L, 8L, 7L, 5L, 7L, 4L, 5L, 9L), Ttest.Cell.vs.MCM.Cell = c(66L,
>>>> 22L, 14L, 7L, 11L, 6L, 12L, 7L, 9L, 8L, 7L, 9L, 9L, 5L, 20L),
>>>>    Ttest.Tumor.vs.MCM.Tumor = c(31L, 18L, 8L, 12L, 5L, 8L, 5L,
>>>>    8L, 9L, 8L, 10L, 12L, 13L, 8L, 18L)), .Names = c("X", "MCM.Cell.vs.MCM.Tumor",
>>>> "Ttest.Tumor.vs.Ttest.Cell", "Ttest.Cell.vs.MCM.Cell", "Ttest.Tumor.vs.MCM.Tumor"
>>>> ), class = "data.frame", row.names = c(NA, -15L))
>>>>
>>>> dotchart(as.matrix(intersect.data[-1]), labels=intersect.data[,1], cex=0.5, gpch=70)
>>>>
>>>> barplot(t(as.matrix(intersect.data[,2:5])), beside=T, horiz=T)
>>>>
>>>> ______________________________________________
>>>> 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.
>>>>
>>>
>>>
>>> --
>>> Henrique Dallazuanna
>>> Curitiba-Paraná-Brasil
>>> 25° 25' 40" S 49° 16' 22" O
>>>
>>> ______________________________________________
>>> 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.
>>>
>>
>>
>> --
>> Henrique Dallazuanna
>> Curitiba-Paraná-Brasil
>> 25° 25' 40" S 49° 16' 22" O
>>
> 
> 
> 




More information about the R-help mailing list