Skip to content

Consistent usage of whitespaces across gallery and tutorial examples #2018

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

Merged
merged 15 commits into from
Jul 25, 2022
Merged

Consistent usage of whitespaces across gallery and tutorial examples #2018

merged 15 commits into from
Jul 25, 2022

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Jul 20, 2022

Description of proposed changes

Fixes #2013


Overview of affected examples

  • Cross-check in the end regarding completeness

Tutorials

Gallery


Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@yvonnefroehlich
Copy link
Member Author

In the section Title of the Tutorial 'Frames, ticks, titles, and labels':

###############################################################################
# Title
# -----
#
# The figure title can be set by passing **+t**\ *title* to the ``frame``
# parameter of :meth:`pygmt.Figure.basemap`. Passing multiple arguments to
# ``frame`` can be done by using a list, as show in the example below.

fig = pygmt.Figure()
# region="IS" specifies Iceland using the ISO country code
fig.coast(shorelines="1/0.5p", region="IS", projection="M25c")
fig.basemap(frame=["a", "+tIceland"])
fig.show()

###############################################################################
# To use a title with multiple words, the title must be placed inside another
# set of quotation marks. To prevent the quotation marks from appearing in the
# figure title, the ``frame`` parameter can be passed in single quotation marks
# and the title can be passed in double quotation marks.

fig = pygmt.Figure()
# region="TT" specifies Trinidad and Tobago
fig.coast(shorelines="1/0.5p", region="TT", projection="M25c")
fig.basemap(frame=["a", '+t"Trinidad and Tobago"'])
fig.show()
  • I would remove the part, which explains the double-quotation-mark trick.
  • I would choose (and adjust) the code for the 'Trinidad and Tobago' map as an example for adding a title, and removed the code for the 'Island' map.

@seisman: Is this fine, or do you prefer to go with the 'Island' map as an example?

@seisman
Copy link
Member

seisman commented Jul 22, 2022

  • I would remove the part, which explains the double-quotation-mark trick.
  • I would choose (and adjust) the code for the 'Trinidad and Tobago' map as an example for adding a title, and removed the code for the 'Island' map.

Both sound good to me!

@seisman seisman added the documentation Improvements or additions to documentation label Jul 22, 2022
@seisman seisman added this to the 0.8.0 milestone Jul 22, 2022
@seisman
Copy link
Member

seisman commented Jul 24, 2022

This PR looks good. Are there any more changes you want to make in this PR?

@seisman
Copy link
Member

seisman commented Jul 24, 2022

I think we also need to update a few tests.

tests/test_basemap.py:        frame=['x1p+l"Crustal age"', "y500+lDepth"],
tests/test_config.py:        region=[0, 10, 0, 10], projection="X5c/5c", frame=["af", '+t"Blue Annotation"']
tests/test_config.py:            frame=['xaf+l"red label"', "yaf", '+t"red annotation"'],
tests/test_config.py:        frame=["af", '+t"Blue Annotation"'],

These tests can be updated in this PR or in a separate PR.

@yvonnefroehlich yvonnefroehlich changed the title WIP: Consistent usage of whitespaces across gallery and tutorial examples Consistent usage of whitespaces across gallery and tutorial examples Jul 24, 2022
@yvonnefroehlich
Copy link
Member Author

This PR looks good. Are there any more changes you want to make in this PR?

Regarding the gallery and tutorials, I think I have found and changed all affected examples.

I think we also need to update a few tests.

Good point! Yes.

These tests can be updated in this PR or in a separate PR.

There is no real preference from my side on this. I can also open a new PR for updating the tests.

Copy link
Member

@seisman seisman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge.

@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Jul 24, 2022
@weiji14
Copy link
Member

weiji14 commented Jul 24, 2022

I think we also need to update a few tests.

tests/test_basemap.py:        frame=['x1p+l"Crustal age"', "y500+lDepth"],
tests/test_config.py:        region=[0, 10, 0, 10], projection="X5c/5c", frame=["af", '+t"Blue Annotation"']
tests/test_config.py:            frame=['xaf+l"red label"', "yaf", '+t"red annotation"'],
tests/test_config.py:        frame=["af", '+t"Blue Annotation"'],

These tests can be updated in this PR or in a separate PR.

Perhaps we should keep a few unit tests around that use the nested quotes, as a regression test to ensure backwards compatibility is preserved?

@seisman
Copy link
Member

seisman commented Jul 24, 2022

I think we also need to update a few tests.

tests/test_basemap.py:        frame=['x1p+l"Crustal age"', "y500+lDepth"],
tests/test_config.py:        region=[0, 10, 0, 10], projection="X5c/5c", frame=["af", '+t"Blue Annotation"']
tests/test_config.py:            frame=['xaf+l"red label"', "yaf", '+t"red annotation"'],
tests/test_config.py:        frame=["af", '+t"Blue Annotation"'],

These tests can be updated in this PR or in a separate PR.

Perhaps we should keep a few unit tests around that use the nested quotes, as a regression test to ensure backwards compatibility is preserved?

We already have the following test in docstrings. Do you think it's enough?

>>> print(
... build_arg_string(
... dict(
... B=["af", "WSne+tBlank Space"],
... F='+t"Empty Spaces"',
... l="'Void Space'",
... ),
... )
... )
-BWSne+tBlank\040Space -Baf -F+t"Empty\040\040Spaces" -l'Void\040Space'

@weiji14
Copy link
Member

weiji14 commented Jul 24, 2022

I think we also need to update a few tests.

tests/test_basemap.py:        frame=['x1p+l"Crustal age"', "y500+lDepth"],
tests/test_config.py:        region=[0, 10, 0, 10], projection="X5c/5c", frame=["af", '+t"Blue Annotation"']
tests/test_config.py:            frame=['xaf+l"red label"', "yaf", '+t"red annotation"'],
tests/test_config.py:        frame=["af", '+t"Blue Annotation"'],

These tests can be updated in this PR or in a separate PR.

Perhaps we should keep a few unit tests around that use the nested quotes, as a regression test to ensure backwards compatibility is preserved?

We already have the following test in docstrings. Do you think it's enough?

>>> print(
... build_arg_string(
... dict(
... B=["af", "WSne+tBlank Space"],
... F='+t"Empty Spaces"',
... l="'Void Space'",
... ),
... )
... )
-BWSne+tBlank\040Space -Baf -F+t"Empty\040\040Spaces" -l'Void\040Space'

Oh yes true. That one should be enough.

@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jul 25, 2022
@seisman seisman merged commit f2fb71f into GenericMappingTools:main Jul 25, 2022
@yvonnefroehlich yvonnefroehlich deleted the use-whitespaces-without-extra-quotes branch July 25, 2022 06:10
@weiji14 weiji14 added the skip-changelog Skip adding Pull Request to changelog label Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent handling of whitespaces in titles and labels across gallery and tutorial examples
4 participants