Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

scatterkwargs usage #64

Closed
mbruna opened this issue Jul 28, 2021 · 7 comments
Closed

scatterkwargs usage #64

mbruna opened this issue Jul 28, 2021 · 7 comments

Comments

@mbruna
Copy link

mbruna commented Jul 28, 2021

I am trying to do plots and videos of an agents.jl simulation that show the underlying geometry (a square lattice). For this I'm trying to plot the minorgrid, and looking at the documentation it seems as if I should be using scatterkwargs. However, when I try the following there is no change (I only see the major grid):

abm_video(
        "test.mp4", model, agent_step!, model_step!;
        framerate = 20, frames = 100,
        scatterkwargs = (minorgrid = true, ),
        title = ("Test")
    )

What am I doing wrong? Thanks a lot!

@Datseris
Copy link
Member

How does one show a minor grid in Makie.jl? Can you provide a MWE that enables minor grids in Makie.jl? If I recall correctly, minor grids weren't really supported.

@Libbum
Copy link
Member

Libbum commented Jul 28, 2021

These are axis properties. @Datseris, I recall a discussion around allowing for an axiskwargs argument for aspect, but I think we decided it was polluting the function too much to provide this. Maybe that needs to be revisited.

@mbruna
Copy link
Author

mbruna commented Jul 28, 2021

Thanks for your replies. I hadn't used Makie.jl before, as I had just upgraded to the Agents.jl version that uses InteractiveDynamics instead of AgentsPlots. The problem arose when I tried to update the following:

plotabm(model; am = agent_arrow, as = 6, minorgrid=true, aspect_ratio=:equal, xlims = (0,params[:Npoints]), ylims = (0,params[:Npoints]))

I guess I will just stick with that for now! Thanks again for your help.

As an aside comment, I think it'd be good to improve on the documentation for scatterkwargs as I couldn't find anywhere what additional keyword arguments are allowed.

@Datseris
Copy link
Member

If you can change these arguments after axis creation, with e.g. ax = content(fig[1,1]); ax.xminorticksvisible = true then no on adding axiskwargs. If you can't alter these after creation then okay for adding axiskwargs.

@mbruna
Copy link
Author

mbruna commented Oct 4, 2021

I have looked at this again. I can't figure out why what you suggested for accessing the axis in Makie does not work for me. For example, if I do

fig, abmstepper = abm_plot(model)
ax = content(fig[1,1])

the output of ax is

GridLayout[1, 1] with 1 children
 ┗━ [1, 1] Axis

And if I try for example to remove the xticks I get the following error:

ax.xticksvisible = false
ERROR: type GridLayout has no field xticksvisible
Stacktrace:
 [1] setproperty!(::GridLayout, ::Symbol, ::Bool) at ./Base.jl:34
 [2] top-level scope at none:1

Same happens if I add some heatmap contained in plotkwargs to the plot

fig, = abm_plot(model; plotkwargs...)
ax = content(fig[1,1])
GridLayout[1, 2] with 2 children
 ┣━ [1, 1] Axis
 ┗━ [1, 2] Colorbar

@Datseris
Copy link
Member

Datseris commented Oct 4, 2021

I think you need to do content(fig[1,1][1,1]). As you can see in the console ouput you paste, what you selected is not an axis, but a grid layout whose entry [1,1] is an actual axis.

@mbruna
Copy link
Author

mbruna commented Oct 5, 2021

Thanks so much!

@Datseris Datseris closed this as completed Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants