I’d like to eliminate the spacing between the bars including eliminating the space between the first bar and the y-axis
The bars are apart 1 unit by default and centered around their values starting at 1, so we set width to 1 and the xlimits to 0.5 and 5.5.
I’d like to also place tick marks between the bars along the x-axis
We can use minor ticks as a workaround because the tick labels are always relative to their ticks, so you can’t technically center them between two. But you can hide the major ticks and use the minor ticks for that.
I’d also like to change the font to Arial, but I’ve been having difficulty figuring out how to do that.
The easiest way is to pass font = "Arial" to the figure settings, via the figure = ... keyword arg. Would otherwise go to Figure(...) if the Figure wasn’t created implicitly with the plot.
Saving worked fine for me, try this:
age_groups = ["0-12", "13-24", "25-36", "37-48", "49-60"]
num_individuals = [35, 23, 17, 13, 12]
f, ax, bp = barplot(
num_individuals,
color=:black,
strokecolor=:white,
strokewidth=1,
width=1,
gap=0,
axis = (
xlabel="Age Groups (in African Elephant years)",
ylabel="Relative Abundance (%)",
title="Type A Profile",
limits=(0.5, 5.5, 0, 35),
yticks=(0:5:35),
xticks=(1:5, age_groups),
xticklabelsize = 14,
xminorticks = 0.5:1:5.5,
xminorticksvisible = true,
xminorticksize = 8,
topspinevisible=false,
rightspinevisible=false,
xgridvisible=false,
ygridvisible=false,
xticksvisible=false
),
figure = (font = "Arial", resolution = (300, 450))
)
save("test.pdf", f)
