Hi:
Another approach is:
v1 = c(1.2, 1.4, 0.9, 1.0, 1.1, 1.0)
v2 = c("aa", "cc", "bb", "bb", "cc", "bb")
v3 = c(8, 10, 11, 9, 9, 10)
df = data.frame(v1=v1, v2=v2, v3=v3)
ggplot(df) + geom_bar(aes(x = reorder(v2, desc(v3
HTH,
Dennis
On Wed, Oct 6, 2010 at 2:09 AM, Morten wrote:
>
> Hi all,
Hi Morten
Just order the factor the way you want before plotting:
df$v2 <- factor(df$v2, levels=c("bb", "cc", "aa"))
p = ggplot(df)
p + aes(v2) + geom_bar()
Best,
Ista
On Wed, Oct 6, 2010 at 5:09 AM, Morten wrote:
>
> Hi all,
>
> I have a large data frame and would like to make a barplot of a
Hi all,
I have a large data frame and would like to make a barplot of a categorical
variable with the bars sorted in order of decreasing frequency.
# Example:
v1 = c(1.2, 1.4, 0.9, 1.0, 1.1, 1.0)
v2 = c("aa", "cc", "bb", "bb", "cc", "bb")
v3 = c(8, 10, 11, 9, 9, 10)
df = data.frame(v1=v1, v2=v2,
3 matches
Mail list logo