Add title and axis labels using abmplot

Hi,

I am using the abmplot function in Agents.jl to plot the location of my agents. It is plotting the agents fine, but I would like to add a title and axis labels. Nothing I have done seems to work. I am using CairoMakie and the relevant code is below. Where do I put the title = “Title” and xlable = “xlabel” statements?

#MAKE a STATIC PLOT of AGENTS

set up the plot

offset(a) = a isa Bank ? (-0.1, -0.1rand()) : (+0.1, +0.1rand())

ashape(a) = a isa Bank ? :circle : :utriangle

#MAKE a STATIC PLOT of AGENTS
set up the plot
offset(a) = a isa Bank ? (-0.1, -0.1rand()) : (+0.1, +0.1rand())
ashape(a) = a isa Bank ? :circle : :utriangleacolor(a) = a isa Bank ? a.acolor : :blue
plotkwargs = (;
agent_color = acolor,
agent_size = 10,
agent_marker = ashape,
offset,
agentsplotkwargs = (strokewidth = 1.0, strokecolor = :black),
)

#create the plot
fig, ax, abmobs = abmplot(testmodel; plotkwargs…)

#see the plot
fig

Solution provided on Julia slack channel dynamics-bridged:
Add modifications to ax after using abmplot(), such as

#create the plot
fig, ax, abmobs = abmplot(testmodel; plotkwargs…)
ax.title = “Title”
ax.xlabel = “East-West”
ax.ylabel = “North-South”
#see the plot
fig

1 Like