How to set the font size for labels in a legend using GMT.jl

I’m new to GMT.jl, I hope to adjust the font size of label (“data”) in the legend as in the following code:

using GMT
lines(1:12, 1:12, figsize=(6,4), legend=(label=“data”,pos=:LT,box=:none,), show=true)

None of FONT_* parameters affects the font size of label in the legend.
Any suggestions would be very helpful.

Use the fontsize=xx inside the legend keyword. e.g.

lines(1:12, 1:12, figsize=(6,4), legend=(label="data",pos=:LT,box=:none, fontsize=12), show=true)

See the plot docs (search for legend and label). And refer also to the GMT table with the fonts names

Thanks. It works.

I found a strange situation. “fontsize” doesn’t work in the following code snippet:

lines(1:12, 1:12, legend=(label="data",pos=:LT,box=:none,fontsize=6))
showfig()

But it works in the following code snippet:

lines(1:12, 1:12, legend=(label="data",pos=:LT,box=:none,fontsize=6),show=true)

Indeed strange. A bug certainly. Can you open an issue in GMT.jl?

sure. It’s done.

I tried to adjust the width of a legend as the following code, and found “width” works, but not “inside”. Have I made any mistake on specifying these parameters?

lines(1:12, 1:12, figsize=(6,4), legend=(label="data",position=(inside=:LT,width=1.5),fontsize=3), show=true)

Sorry, I don’t have an answer right now. Maybe better to continue this oven an issue. inside is the default but I need to investigate/search how to do outside.

Note, fine control on the legend (text) width is tricky since on the Julia side I can’t really know the text true font size in cm.

Thanks. I’ve opened an issue.