Hello Everyone,
The plot, using Gadfly.jl, that I am trying to make requires me to jitter the points in a grid plot. But I cannot figure out how? The code example below replicates my situation. Please suggest what may I be missing?
Fake Data:
df_plot = DataFrame(
model = repeat([“M1”,“M2”, “M3”, “M4”, “M5”, “M6”,“M7”,“M8”],inner=5),
metric = repeat([“Me1”,“Me2”, “Me3”, “Me4”],outer=10),
sample = repeat(1:2,outer=20),
value=rand(40)
)
A plot with jitter but without a grid
I am putting this plot here to show how the jitter looks in my data
Code
Gadfly.plot(df_plot,
x=:sample,
color = :model,
y=:value,
Geom.point, Stat.x_jitter(range=0.4),
Scale.x_discrete
)
Plot
Now, if I add Geom.subplot_grid, the jitter functionality seems to stop working
Code
Gadfly.plot(df_plot,
x=:sample,
color = :model,
xgroup = :metric, # Added this new parameter
y=:value,
Geom.subplot_grid(Geom.point, Stat.x_jitter(range=0.4),
free_x_axis = true), #Updated to subplot_grid
Scale.x_discrete
)
Plot
I also tried to put x_jitter out of subplot_grid, but it doesn’t work! Please advise.
Stat.x_jitter(range=0.2),
Geom.subplot_grid(Geom.point,
free_x_axis = true), #Updated to subplot_grid