Re: [R] Multivariable barplot

From: Domenico Vistocco <vistocco_at_unicas.it>
Date: Tue, 22 Jan 2008 13:04:26 +0100

Domenico Vistocco wrote:

> Pilar Loren wrote:
>   

>> Hi, is it possible to do a multivariable barplot with ggplot2?
>>
>> I have something like that:
>>
>>
>>
>>> df
>>>
>>>
>> LENGTH LAT
>> 091639 10.002 42.26282
>> 091640 30.808 42.26834
>> 091641 21.591 42.31689
>> 091642 22.030 41.53246
>> 091643 22.744 42.01954
>> 091644 12.702 42.67751
>> 091645 39.728 42.06479
>> 091647 63.057 41.25283
>> 091648 19.523 41.01925
>> 091649 13.336 42.46904
>> 091650 8.935 42.80971
>> 091651 25.275 42.50678
>> 091652 9.983 42.89345
>> 091653 9.416 41.15288
>>
>>
>>
>>> p <- ggplot(df)
>>> p <- p + geom_bar(aes(x=rownames(df), y=LENGTH), position="dodge",
>>>
>>>
>> fill="red")
>>
>>
>>> p <- p + geom_bar(aes(x=rownames(df), y=LAT), position="dodge",
>>>
>>>
>> fill="green")
>>
>>
>>> p
>>>
>>>
Sorry (I missed to past a command before the melt command): df=data.frame(idrow=rownames(df), df)
> df2=melt(id="idrow", df)
> qplot(data=df2, x=idrow, y=value, 
> fill=variable,stat="identity",geom="bar", position="dodge")
>
> Ciao,
> domenico
>   

>> but the result graphics are overlapping.
>>
>> Thank for your help
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>>
>>
>
> ______________________________________________
> 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.
>
>

______________________________________________
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. Received on Tue 22 Jan 2008 - 12:07:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jan 2008 - 12:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive