Axis labels error display

Hi,
i am new to pygmt and would like to making my first figure. However, there are something wrong with the axis labels of the simple figure.

code:

import pygmt
fig = pygmt.Figure()
with pygmt.config(MAP_FRAME_TYPE="plain"):
    fig.basemap(region=[108, 120, -5, 8], projection="M20c", frame=True)
fig.coast(land="black", water="skyblue")
with open("examples.txt", "w") as f:
    f.write("114 0.5 0 22p,Helvetica-Bold,white CM BORNEO\n")
    f.write("119 3.25 0 12p,Helvetica-Bold,black CM CELEBES SEA\n")
    f.write("112 -4.6 0 12p,Helvetica-Bold,black CM JAVA SEA\n")
    f.write("112 6 40 12p,Helvetica-Bold,black CM SOUTH CHINA SEA\n")
    f.write("119.12 7.25 -40 12p,Helvetica-Bold,black CM SULU SEA\n")
    f.write("118.4 -1 65 12p,Helvetica-Bold,black CM MAKASSAR STRAIT\n")
fig.text(textfiles="examples.txt", angle=True, font=True, justify=True)
os.remove("examples.txt")
fig.savefig('plottext.png')
fig.savefig('test.png')

my figure:

the correct figure:

Thank you for any guidance.

When I run your code everything looks fine, except the text you export which does not appear. Btw, why do you export it into a textfile and why do you save it twice? Next time, please also format your code as preformatted text which makes it much more easy to simply copy-paste it.

First, thank you very much for your reply.
This is my firsttime to make a question here, i’m learnning how to use this.
Maybe i didn’t explain clearly.
When i use the parameters frame=‘f’, the result is fine.
code:

import pygmt

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c")
fig.basemap(frame="f")
fig.savefig('test.png')

result:


But when i use “frame=True” or “frame=a”, we will get the results with axis labels error display.
code(frame=True):

import pygmt

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c")
fig.basemap(frame=True)
fig.savefig('test.png')

result:


code(frame=‘a’):

import pygmt

fig = pygmt.Figure()
fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c")
fig.basemap(frame='a')
fig.savefig('test.png')

result:

For both versions of your code I receive the expected result (see below). Which version of PyGMT and GMT do you currently use and on which system? Are the uploaded figures the plots that were generated by fig.savefig() or did you load them into another graphics program?

GMT version: 6.2.0
PYGMT version: 0.5.0
system: windows 7 professional

The figures were generated by fig.savefig() and i didn’t load them into another graphics program. I uninstall the GMT and install it again, but there is nothing to change of result.

Perhaps you have a “gmt.conf” file in your HOME directory, and the FORMAT_GEO_MAP parameter is set to an invalid value like %s?

Thanks for your advice.I want to know whice HOME did you talk about?
And the axis labels errors display only happens on using the python to plot. It is OK,when i plot with GMT directly.What a annoying problem!I just want to process my data and get the figures of the data all in python. :joy: