You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I'm using Julia 0.4.3 and Gadfly 0.4.2. Gadfly is nice!
Here is a plot:
using Gadfly
using DataFrames
function dsinc(r, x,y)
z = sqrt(x.^2 + y.^2)
z = cos(z)./z - sin(z)./(z.^r)
return DataFrame(x=x, y=y, z=(z+1), r="r=$r")
end
randu(n, u) = u*rand(n)-(u/2)
srand(1234)
q = linspace(-10, 10, 40)
X = vcat([[i j] for i in q, j in q]...)
D1 = vcat([dsinc(r, X[:,1],X[:,2]) for r in 1:2]...)
D2 = DataFrame(x1=randu(8,18), y1=randu(8,18),col=3.0, id=[1,1,2,2,3,3,4,4], r="r=1")
D3 = DataFrame(x2=[0.,0.], y2=[0.,0.], col2=3.0, r=["r=1","r=2"])
coord = Coord.cartesian(xmin=-10.0, xmax=10.0, ymin=-10.0, ymax=10.0)
p = plot(
Geom.subplot_grid(coord,
layer(D1, x=:x, y=:y, color=:z, Geom.rectbin, order=1, xgroup=:r),
layer(D2, x=:x1, y=:y1, color=:col, group=:id, Geom.line, order =2, xgroup=:r),
# layer(D3, x=:x2, y=:y2, color=:col2, Geom.point, order=3, xgroup=:r)
),
Guide.title(join(["r=1","r=2"], " "^48)),
Guide.xlabel("X<sub>1</sub>"),
Guide.ylabel("X<sub>2</sub>"),
Guide.colorkey("z")
)
And here are some issues:
i) When using multiple layers, the facet labels aren't automatically included on the plot. I have added a workaround here by putting them in Guide.title.
ii) For the layer with Geom.line, if I remove color=, and try to instead to do:
layer(D2, ..., Geom.line, Theme(default_color=colorant"red")) then I get an error. It seems that I am forced to "apply" the color scheme in the first layer to the second layer, as I have done in the above example. Also, bizarre things happen if I try replacing col=3.0, with col="red" in DataFrame D2.
iii) It would be nice to have a Geom.segment(x=, y=, xend=, yend=) to make it easier to add multiple lines, as in ggplot.
iv) I know Gadfly suggests not to do this if you try (even if you are facetting on the same variable):
but as long as I'm facetting on the same variable e.g. xgroup=:r, I think that including Geom.subplot_grid within the layer is a nicer syntax than the otherway around. This syntax seems more appealing (to me) in adding a layer that is not facetted (i.e.where the same geoms appear on all subplots). Here is an example.If I uncomment the:
You can fix issue (i) by passing the data frame and the xgroup argument to the outer plot call, as shown in the test file layered_subplots.jl, instead of passing them to each layer call separately.
However, this only works when you're using the same data frame in every subplot.
Hi I'm using Julia 0.4.3 and Gadfly 0.4.2. Gadfly is nice!
Here is a plot:
And here are some issues:
i) When using multiple layers, the facet labels aren't automatically included on the plot. I have added a workaround here by putting them in Guide.title.
ii) For the layer with Geom.line, if I remove color=, and try to instead to do:
layer(D2, ..., Geom.line, Theme(default_color=colorant"red")) then I get an error. It seems that I am forced to "apply" the color scheme in the first layer to the second layer, as I have done in the above example. Also, bizarre things happen if I try replacing col=3.0, with col="red" in DataFrame D2.
iii) It would be nice to have a Geom.segment(x=, y=, xend=, yend=) to make it easier to add multiple lines, as in ggplot.
iv) I know Gadfly suggests not to do this if you try (even if you are facetting on the same variable):
but as long as I'm facetting on the same variable e.g. xgroup=:r, I think that including Geom.subplot_grid within the layer is a nicer syntax than the otherway around. This syntax seems more appealing (to me) in adding a layer that is not facetted (i.e.where the same geoms appear on all subplots). Here is an example.If I uncomment the:
in the above code, this results in strange behaviour. But then this third layer works if I comment out the first layer (the Geom.rectbin layer)!
The text was updated successfully, but these errors were encountered: