Leg = false?

Just a quick question, what does leg=false or leg=true mean, for example in the following command
hline!([m, m+σ, m-σ], lw=3, ls=:dash, leg=false)

I tried to set leg to true and false, but can’t see any observable difference.

Thank you!

I’ll guess that you’re talking about Plots.jl, in which case I also guess that “leg” is short for legend and that hline disables legend anyway. You might try setting it to true in a separate plot command which may cause the legend to appear. The imaginary use case is you plot some data and want it to be labeled in a legend, and you add a horizontal or vertical line to the plot and don’t want it labeled like data. I’m speculating and haven’t tried it. Edit: revision

2 Likes

Thank you! I tried both options many times, but I was focusing too much on the lines and dots and didn’t realized there are differences in the legend. Thank you!

For the future, the page “attributes” in the Plots documentation lists all of the attributes and their options. This one is probably under subplot attributes.

1 Like

@gustaphe is right on. The documentation is under subplots at Subplot Attributes · Plots

If you look under ‘legend’, you will see that besides using boolean values, you can use leg to specify the legend location. (although that is irrelevant in this case as @apo383 points out :smile:)

1 Like