I think you might have to put the Geom.subplot_grid inside the layers.
On Friday, July 25, 2014 7:37:48 PM UTC+3, Leah Hanson wrote:
>
> I am trying to make a relatively complicated graph in Gadfly, and am
> struggling.
>
> This is some sample data with the same structure as my data.
> ~~~
> julia> t = readtable("testdata.csv")
> 9x5 DataFrame
> |-------|---------|------|-------|--------|--------|
> | Row # | _type | rank | speed | thing1 | thing2 |
> | 1 | "red" | 1 | 10.0 | 0.0 | 0.0 |
> | 2 | "red" | 2 | 11.1 | 0.1 | 0.2 |
> | 3 | "red" | 3 | 12.4 | 0.3 | 0.0 |
> | 4 | "green" | 1 | 8.0 | 0.2 | 1.0 |
> | 5 | "green" | 2 | 7.0 | 0.1 | 0.5 |
> | 6 | "green" | 3 | 9.0 | 0.2 | 0.0 |
> | 7 | "blue" | 1 | 1.0 | 1.0 | 1.0 |
> | 8 | "blue" | 2 | 2.0 | 0.2 | 0.2 |
> | 9 | "blue" | 3 | 3.0 | 0.1 | 0.1 |
> ~~~
>
> Currently, I am trying to make a plot with three rows; each row has a plot
> with two layers. The rows are by :_type. The x-axis for everything is
> :rank. The two layers should be scatterplots of :thing1 and :thing2.
>
> I have tried several variations, here is one of them:
> ~~~
> julia>
> plot(t,Geom.subplot_grid(Geom.point),ygroup=:_type,layer(x=:rank,y=:thing1),layer(x=:rank,y=:thing2))
> Error showing value of type Plot:
> ERROR: The following aesthetics are required by Geom.point but are not
> defined: x, y
>
> in error at error.jl:21
> in assert_aesthetics_defined at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/aesthetics.jl:148
> in render at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/geom/point.jl:27
> in render_prepared at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:718
> in render at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/geom/subplot.jl:234
> in render_prepared at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:718
> in render at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:673
> in display at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:922
> in display at
> /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:837
> in print_response at REPL.jl:140
> in print_response at REPL.jl:125
> in anonymous at REPL.jl:584
> in run_interface at ./LineEdit.jl:1377
> in run_frontend at ./REPL.jl:816
> in run_repl at ./REPL.jl:170
> in _start at ./client.jl:399
> ~~~
>
> How do I put layers inside a subplot?
>
> Thanks,
> Leah
>