Canvas fill (+g) issue with GMT-MATAB

Dear all,
Have an issue with GMT Matlab API.
Plotting additional data over a filled canvas plot (with the +g option - B) destroys the fill in MATLAB. But the BATCH script works fine.
Can anybody please confirm this issue…?

my GMT version 6.4.

Thank you so much

-------- GMT BATCH SCRIPT------------WORKS FINE

gmt psxy 84_data.txt -R-2.5/2.5/1588.24/1965.35 -JX5i/-2i -Ggold3 -Bxa1f0.5+l"Distance(km)" -W1 -BSW+g230/240/250 -Bya100f1000+l"Depth(m)" -X3 -L+yt -P -V -K > Works_fine.ps
gmt psxy locals.txt -R-2.5/2.5/1588.24/1965.35 -JX5i/-2i -St0.08i -Gred -O -V >> Works_fine.ps

------- GMT MALAB -----------NOT WORKING

gmt(‘create’);
gmt(‘psxy 84_data.txt -R-2.5/2.5/1588.24/1965.35 -JX5i/-2i -Ggold3 -Bxa1f0.5+l"Distance(km)" -W1 -BSW+g230/240/250 -Bya100f1000+l"Depth(m)" -X3 -L+yt -P -V -K > gmt_MATLAB.ps’);
gmt(‘psxy locals.txt -R-2.5/2.5/1588.24/1965.35 -JX5i/-2i -St0.08i -Gred -O -V >> gmt_MATLAB.ps’);
gmt(‘destroy’);


gmt_MATLAB.ps (25.7 KB) Works_fine.ps (25.6 KB)

84_data.txt (7.0 KB) locals.txt (320 Bytes)

You don’t need the first gmt(`create`) nor the last gmt(`destroy`) but it looks like the GMT shared lib is remembering too much between the two psxy calls. If ypu put the gmt(`destroy`) between the two psxy than it will work. This is a bug ofc but not an easy one to find.

1 Like

Dear Joaquim,
Thank you so much for your suggestion and confirmation.
Inserting gmt(‘destroy’) between the lines worked fine.
Thanks :heart_eyes: