ggplot中的堆叠条形图

时间:2018-09-10 10:14:38

标签: r ggplot2

with t (a) as (
  select 20180107099 from dual union all
  select 20180108002 from dual union all
  select 20180108003 from dual union all
  select 20180108004 from dual )
select a from (select a, lag(a) over(order by a) + 1 as lg from t)
  where lg <> a

希望岁月并肩,但它们彼此重叠。

ggplot(aushealth, aes(x=condition, y=Population, fill=year)) +
+ geom_bar(stat="identity", position=position_dodge())

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

您的代码中有一些错误:

class test1
{
    testName: string;
    testNum: number;
}

class test2 extends test1
{

    constructor(conName:string, conNum: number)
    {
        super()
    }
}

tt = "Condition Year Population Asthma 2001 10.0 Asthma 2017 13.1 Back_Issue 2001 7.5 Back_Issue 2017 6.3" dat <- read.table(text = tt, header = T) ggplot(dat, aes(x=Condition, y=Population, fill=as.factor(Year))) + geom_bar(stat="identity", position=position_dodge()) 不是大写字母C,也请在Condition上使用as.factor。那是主要问题。

enter image description here