Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fig.plot fails when labels contain spaces #402

Closed
firstkingofrome opened this issue Mar 25, 2020 · 3 comments
Closed

fig.plot fails when labels contain spaces #402

firstkingofrome opened this issue Mar 25, 2020 · 3 comments
Labels
question Further information is requested

Comments

@firstkingofrome
Copy link

firstkingofrome commented Mar 25, 2020

Hello, I am unable to use the figure.plot command if my label contains a space:
For example the following works:

import pygmt as gmt
fig = gmt.Figure()
h1 = fig.plot(x=[-5], y=[5], region=[-10, 10, -5, 10], projection='X3i/0', frame='a',
style='a25p', color="purple",label="H 1")
h2 = fig.plot(x=[0], y=[5],
style='t15p', color='cyan',label="H2")
fig.legend(position="JBL+jBL+o0.2c",L="2p",box="+gseashell")
fig.show()

However if I change a label to include a space, the plot instruction fails:
GMTCLibError: Module 'plot' failed with status code 71:
plot [ERROR]: Error for input file: No such file (1)
`import pygmt as gmt
fig = gmt.Figure()

h1 = fig.plot(x=[-5], y=[5], region=[-10, 10, -5, 10], projection='X3i/0', frame='a',
style='a25p', color="purple",label="H 1")
h2 = fig.plot(x=[0], y=[5],
style='t15p', color='cyan',label="H2")
fig.legend(position="JBL+jBL+o0.2c",L="2p",box="+gseashell")
fig.show()`

Any idea how to fix this?
Thank You I appreciate any assistance!

@weiji14 weiji14 added the question Further information is requested label Mar 25, 2020
@seisman
Copy link
Member

seisman commented Mar 25, 2020

Same issue as #247. Please refer to #247 for workarounds.

@weiji14
Copy link
Member

weiji14 commented Mar 25, 2020

Hi @firstkingofrome,

It's a known problem in #247. You'll need to do:

h1 = fig.plot(x=[-5], y=[5], region=[-10, 10, -5, 10], projection='X3i/0', frame='a', style='a25p', color="purple", label="'H 1'")

Note that is has to be single-quotes ' ' nested inside the double-quotes " ".

Feel free to close this if it solves your problem 😄. Also just so you know, you're welcome to post more questions on our forum at https://forum.generic-mapping-tools.org/, just sign in with your Github account. Cheers.

@firstkingofrome
Copy link
Author

Oh ok thank you ill do that! Also sorry I didn't see that other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants