Multilevel (Hierarchical) Axis
bray2016 opened this issue · comments
Looking for a way to specify two separate axis layers for a line plot. Something like this figure. I've been able to find a lot of examples of how to do this with categorical distinctions, but not with a date variable.
you mean you just want to plot multiple lines with a time axis?
julia> using Gadfly, Dates, DataFrames
julia> df = DataFrame(t=Date(2020):Month(1):Date(2021), x=1:13, y=2:14, z=3:15)
13×4 DataFrame
Row │ t x y z
│ Date Int64 Int64 Int64
─────┼─────────────────────────────────
1 │ 2020-01-01 1 2 3
2 │ 2020-02-01 2 3 4
3 │ 2020-03-01 3 4 5
4 │ 2020-04-01 4 5 6
5 │ 2020-05-01 5 6 7
6 │ 2020-06-01 6 7 8
7 │ 2020-07-01 7 8 9
8 │ 2020-08-01 8 9 10
9 │ 2020-09-01 9 10 11
10 │ 2020-10-01 10 11 12
11 │ 2020-11-01 11 12 13
12 │ 2020-12-01 12 13 14
13 │ 2021-01-01 13 14 15
julia> plot(stack(df, [:x, :y, :z]), x=:t, y=:value, color=:variable, Geom.line)
Im more looking for a way to have month and then have year below each month for multiple years. Something like:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
----------------------- 2013------------------------------------------------------2014
Ignore the dashes, they are just to get the years in the right spots.
Perhaps like in #1310 (comment), but with xgroup=:year, x=:month
. That style would emphasize the year-to-year differences, if that is of interest.
Thanks for the suggestion. The issue is I am dealing with about 20 years worth of time series data, so I think showing 20 separate panels of yearly data could be a little overwhelming. Ideally, I could show it all on one graph so one could see the monthly variation for specific years as well as the aggregate trend across years