pyGmt -savefig()-save location

Hello everyone, I would like to ask a question about the pyGMT save path: how to specify the save location of the output image? I wrote the entire path in savefig(), but the image is still saved in local/temp. Another question is, why do I still export PDF when I specify PNG as the output format?

For me, this works to save a figure to the specified absolute file path with a jpeg output. Can you share the code you are using?

import pygmt
fig = pygmt.Figure()
fig.basemap(frame=True, region=[0, 1, 0, 1], projection="X10c")