[R] dot plot with error bands

Alexey Bessudnov bessudnov at googlemail.com
Mon May 10 22:10:53 CEST 2010


Many thanks for this suggestion. Indeed, "labels" turned out to be a 
factor, and after reordering the levels I got the plot I wanted.

Alexey


David Winsemius wrote:
>
> On May 10, 2010, at 10:00 AM, Alexey Bessudnov wrote:
>
>> Dear all,
>>
>> I'm trying to create a dot plot with error bands with
>>
>> Dotplot(labels ~ Cbind(estimate, lower, upper), data=For.plot)
>>
>> where estimate, lower and upper are numerical vectors, and labels is 
>> a character vector that contains labels.
>>
>> The problem is that labels are automatically sorted alphabetically, 
>> and I want them to be sorted by estimate (as in my data frame). This 
>> should be straightforward, but unfortunately being new to R I can't 
>> figure out how to do this. I'll appreciate your guidance.
>
> Have you tried making "labels" (an unfortunate choice for a variable 
> name, BTW) a factor variable with levels in the order of your desire?
>
> (Also being new to R, you may not recognize the difference between a 
> factor variable and a character vector, so producing a more explicit 
> description of the dataframe "For.plot" with the str function ought to 
> be your next contribution to this thread if the above solution is not 
> effective.
>



More information about the R-help mailing list