Legend from a input file

Dear All,
I am trying to use an input file for the legend on my map (attached).fault_legend.dat (237 Bytes)

I did the command:

fig.legend(spec=r'D:\Inves\MT\map_data\fault_legend.dat', 
           position="jTR+o0.1c", box=True) 

However I get the following error:

GMTCLibError: Module ‘legend’ failed with status code 79:
legend [ERROR]: Must specify -D…+w if codes other than D, H, L, S, V are used

Is the error related to input file?, would you mind give me some tips on it.
Stay safe and best regards,
Tonino

Hi Tonino:

The error indicated that you must specify -D…+w, so you just add: position=“jTR+o0.1c+w3.5c”
You can adjust the “+w3.5c” to change the size of the box.

I just tried to plot the legend file and I got the result below:
image

PTT

@Truyenpt, thank you for the tip,
stay safe and best regards
Tonino

1 Like

Dear @Truyenpt,
Is there a way to specify the color for the lines at the legend box?. I tried with the following line:

S 0.25c - 0.5c magenta thin 0.7c Mandeyapecua

but it keeps like black line, any suggestions?
Stay safe and best regards
Tonino

Hi Tonino:

You can try this code:

S 0.25c - 0.5c - 2.0p, red 0.7c Mandeyapecua

Cheers!

PTT

1 Like

Dear @Truyenpt,
Thank you, it worked.
Stay safe and best regards,
Tonino