Hi
I am using AlgebraOfGraphics
for data visualisation.
I have used below code to get xy scatter plot .
plt_idv = data(df) * mapping(:DV_ipred,:DV)
draw(plt_idv)
fg1 = draw(plt_idv,axis = (xticks = 0:1:6,yticks = 0:1:6,ylabel = "observations", xlabel = "individual predictions"))
it gave me a plot with xticks of 0,1,2,3,4 and y ticks of 0,1,2,3,4,5
How can i get same ticks on both x and y axis. (0,1,2,3,4,5,6)
and also can you please suggest how to get a identical diagonal line for x and y axis.
Hope i am clear.
Thank you
oheil
2
fg1 = draw( plt_idv,
axis = (
aspect = 1,
limits = (0,6,0,6),
xticks = 0:1:6,
yticks = 0:1:6,
ylabel = "observations",
xlabel = "individual predictions"
)
)
For the diagonal line and as complete MWE:
using AlgebraOfGraphics, GLMakie, DataFrames
df = DataFrame(:DV => [2,3,4,5],:DV_ipred => [2,2,3,5] )
plt_idv = data(df)
dfline = (; :DV => 0:6, :DV_ipred => 0:6)
layers = data(dfline) * visual(Lines) + plt_idv * visual(Scatter)
axis = (
width = 250,
height = 250,
aspect = 1,
limits = (0,6,0,6),
xticks = 0:1:6,
yticks = 0:1:6,
ylabel = "observations",
xlabel = "individual predictions"
)
fg1 = draw(layers * mapping(:DV_ipred, :DV) ; axis)
You can find the axis attributes e.g. for the Makie backend here: API
Putting the line and scatter into the same plot I utilized this example: Lines and markers ยท Algebra of Graphics