Warning and error when adding a legend

Hi! I’m adding some legends for my map. These include lines(faults, trenches) and volcanoes. The plotted lines came from some shp file then I converted to .gmt file.

fig.plot(
data=“AF.gmt”,
pen=“red”,
label = ‘Fault’
)

fig.plot(
data=“trench.gmt”,
Sf = ‘+.3i/.1i+l+t’,
pen=“.8p,blue”,
label = ‘Trench’
)

fig.plot(
x =volLon,
y =volLat,
Sk = ‘volcano/0.2i’,
color = ‘red’,
label = ‘Volcano’
)

fig.legend(position=“JTR+jTR+o0.2c”, box=‘+gwhite+p1p’)

When I tried to add these to a legend box, it threw a warning and an error.

plot [WARNING]: Cannot use auto-legend -l for selected feature. Option -l ignored.

plot [ERROR]: Could not find either custom symbol or EPS macro

Hi @dorotdot, thanks for trying out PyGMT! Looks like we’ll need some more information to help you out though. Since there’s 3 fig.plot commands, could you tell us which one is the one reporting the warning or error? Also, if it’s ok with you, it will help to provide us with a sample of your “AF.gmt” and “trench.gmt” files (either make a *.zip file or change *.gmt to *.txt so that you can upload it).

Hi @weiji14, thank you for the reply.

I think the

plot [WARNING]: Cannot use auto-legend -l for selected feature. Option -l ignored.

is the result of putting the plot of .gmt(AF and trench.gmt) in the legends

and the

plot [ERROR]: Could not find either custom symbol or EPS macro

is caused by the label volcano.

I put a link to a google drive to these files. Sorry, I can’t attach the files caused it’s big.
https://drive.google.com/drive/folders/103g28D-SS1qNvQSFHxk6PuW46vm6vtUI?usp=sharing

This my whole code

import os, pygmt
import pandas as pd

region=[119.166,123.681,16.948,20.411]
volLat = [19.52408,18.22116,18.83037,19.07533,19.53915]
volLon = [121.95005,122.1163,121.86280,122.20147,121.91367]
fig = pygmt.Figure()
fig.coast(
	region = region,
	projection= 'M15c',
	shorelines=True,
	water = 'skyblue',
	land = '112/128/144',
	frame= 'a1f1',
	resolution = 'f'
)

fig.plot(
    data="AF.gmt",
    pen="red",
    label = 'Fault'
)

fig.plot(
    data="trench.gmt",
    Sf = '+.3i/.1i+l+t',
    pen=".8p,blue",
    label = 'Trench'
)

fig.plot(
	x =volLon,
	y =volLat,
	Sk = 'volcano/0.2i',
	color = 'red',
	label = 'Volcano'
)

fig.legend(position="JTR+jTR+o0.2c", box='+gwhite+p1p')
fig.savefig("out.png")

I met the same question. I wonder whether fig.legend supports the custom symbols?