Positioning axis labels in Plots

This might be a very basic question, but how do you right-align the axis labels in a histogram plot? It seems the default is to have them centered, both for the y-axis and the x-axis.

In this simple MWE I would want "frequency" and "probability" to be right-aligned:

bins = 0:0.05:1
y1 = rand(100)
histogram(y1, ylims = (0,50), ylabel = "frequency", xlabel = "probability"; bins)

Something like this?


histogram(y1, ylims = (0,50), ylabel = "frequency", xlabel = "probability"; bins, xguidefonthalign = :right, yguidefontvalign = :top)

There are more examples in the documentation here: https://docs.juliaplots.org/latest/generated/gr/#gr-ref54

billede

1 Like