-
Notifications
You must be signed in to change notification settings - Fork 220
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
Arguments with spaces in strings #247
Comments
This is something we'll have to work on. I really don't like the way that -B works right now. It's very non-intuitive and requires the user to specify it multiple times. There shouldn't be a single argument for setting labels, titles, gridlines, tickmarks, etc. See #249. I think that's a better solution than trying to guess what the user is doing with their ticks. |
Wrapping the `subplot` function, in a `with` statement! Original GMT `subplot` function can be found at https://docs.generic-mapping-tools.org/6.1/subplot.html. This is the 3rd attempt at implementing `subplot` in PyGMT, with commits heavily re-adapted/cherry-picked from #412 and #427. * Add fig.subplot and fig.set_panel to API docs * Alias fixedlabel (A), clearance (C), verbose (V) for set_panel * Turn fig.set_panel into a context manager * Alias projection (J), region (R), verbose (V), x/yshift (X/Y) for subplot * Allow for spaces in title and labels without needing double quotes Mitigates against #247. * Allow for list inputs into fig.set_panel(panel=...) * Rename sca to set_panel and ax to panel * Fix bug that prevented boolean to -A from working * Add note that subplot panel is activated until further notice * Validate subplot nrows/ncols and figsize/subsize argument inputs * Revise advanced subplot layout subsection to use two subplots calls Co-authored-by: Dongdong Tian <[email protected]>
NOTE: the |
Just had an idea from #1474 (comment), how about we find and replace space characters ( import pygmt
fig = pygmt.Figure()
# 1st way: SUCCEED! without needing double quotes
fig.basemap(region=[0, 2, 4, 8], projection="X2c", frame=r"WSne+tPlot\040Zero")
# 2nd way: SUCCEED as usual
fig.basemap(frame=r'WSne+t"Plot\040One"', xshift="3c")
# 3rd way: SUCCEED! But with single quotes
fig.basemap(frame=r"WSne+t'Plot\040Two'", xshift="3c")
fig.savefig("plots_with_spaces.png")
fig.show() Caveat is that we will need to use raw-strings |
Wrapping the `subplot` function, in a `with` statement! Original GMT `subplot` function can be found at https://docs.generic-mapping-tools.org/6.1/subplot.html. This is the 3rd attempt at implementing `subplot` in PyGMT, with commits heavily re-adapted/cherry-picked from GenericMappingTools#412 and GenericMappingTools#427. * Add fig.subplot and fig.set_panel to API docs * Alias fixedlabel (A), clearance (C), verbose (V) for set_panel * Turn fig.set_panel into a context manager * Alias projection (J), region (R), verbose (V), x/yshift (X/Y) for subplot * Allow for spaces in title and labels without needing double quotes Mitigates against GenericMappingTools#247. * Allow for list inputs into fig.set_panel(panel=...) * Rename sca to set_panel and ax to panel * Fix bug that prevented boolean to -A from working * Add note that subplot panel is activated until further notice * Validate subplot nrows/ncols and figsize/subsize argument inputs * Revise advanced subplot layout subsection to use two subplots calls Co-authored-by: Dongdong Tian <[email protected]>
Description of the problem
Full code that generated the error
I tried to plot a basemap with an axis labelled as "Crust Age". I tried in three different ways:
Full error message
The 1st way is equivalent to command line
The command fails because "Age" is thought to be a file. However, the error message is almost useless to help users find the error. Do you think it's technically possible to automatically add quotes around strings with spaces if users forget to do that?
The 2nd way works as expected. However, I don't understand why the 3rd way fails? The equivalent cmd version works:
System information
The text was updated successfully, but these errors were encountered: