Consider this simple tibble
tibble(time = c(ymd('2019-01-01'),
ymd('2019-01-02'),
ymd('2019-01-03'),
ymd('2019-01-04'),
ymd('2019-01-05')),
var1 = c(1,2,3,4,5),
var2 = c(2,0,1,2,0))
# A tibble: 5 x 3
time var1 var2
<date> <dbl> <dbl>
1 2019-01-01 1 2
2 2019-01-02 2 0
3 2019-01-03 3 1
4 2019-01-04 4 2
5 2019-01-04 5 0
I would like to create a stacked area chart using lattice
, where time
is on the x
axis and var1
and var2
are stacked (on the y
axis) over time.
Is it possible to do so?
Thanks!