Problem using margin on plots


#1

Hey everyone,

I have the following problem. I want to plot something and use the Unicode symbol for beta as xlabel. However, it gets cut off like this:

using Plots; pyplot();
plot(rand(10))
xlabel!("\beta") 

image

It seems to me, that I should adjust the bottom margin like this:

using Plots; pyplot();
plot(rand(10), bottom_margin = 10mm)
xlabel!("\beta") 

like in the documentation here: http://docs.juliaplots.org/latest/examples/pyplot/#layouts-margins-label-rotation-title-location

This gives me however the following error:

<strong>UndefVarError: mm not defined</strong>

in top-level scope at [base\none](#)

Does anybody know what to do?

Thanks a lot!


#2

I have ran into this problem before! There is some package or something you have to enable to be able to use the mm notation. I will try to remember what it is (although someone might beat me to the punch).


#3

Found it. Add using Plots.PlotMeasures and the mm notation should work.


#4

Thanks, that got rid of the error message, but didn’t solve my problem. Now there is more space below the beta, but its top is still cut off. :confused:


#5

Hmm, this seems to be particular to the PyPlot backend. Other backends increase the margin between the label and axis but PyPlot pads below the label instead. If you try another backend (GR, Plotly, etc.) you can do what you want.