Gadfly.jl
Gadfly.jl copied to clipboard
Adjusting coordinate system when using Geom.subplot_grid fails
I've been looking through previous issues and google, but haven't found a solution to defining a custom plotting range in subplot_grid
. I specifically Have discrete integer data from 1900:2015
, but Coord.cartesian
cannot be applied to a subplot_grid
. Is this possible?
Have you tried doing Geom.subplot_grid(Coord.cartesian())
?
I just ran into this too and it looks like my proposed solution doesn't work.
using DataFrames, Gadfly
srand(123)
a = DataFrame(:a=>rand(20).*15, :b=>rand(20), :c=>rand(0:1, 20))
plot(a, x=:a, y=:b, xgroup=:c, Geom.subplot_grid(Geom.line))
Clipping doesn't work
plot(a, x=:a, y=:b, xgroup=:c, Geom.subplot_grid(Geom.line, Coord.cartesian(xmax=10)))
Expansion does?
plot(a, x=:a, y=:b, xgroup=:c, Geom.subplot_grid(Geom.line, Coord.cartesian(xmax=30)))
Thoughts @bjarthur and @Mattriks?
For people coming across this issue, Guide.xticks
works for me in a similar case. Even with multiple layers inside Geom.subplot_grid
.
I had the same issue when trying to constrain the y range of the subplots. Interestingly the labels and ticks on the y axis get adapted in all subplots. In subplots where the entire line of plots (i.e. plots sharing the same y scale) has no data outside (ymin, ymax) the plots are correct, however, otherwise the labels and ticks are shown correctly (albeit squeezed together accordingly) while the scale of the actual plot doesn't change and data is still plotted over the entire range (i.e. outside of (ymin, max)).