question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to reproduce original GMT arguments in PyGMT documentation

See original GitHub issue

Description of the desired feature

The GMT documentation has many instances where bold and italicized fonts are mixed, looking something like:

+nargs

The PyGMT documentation has been rather inconsistent with this (see mentions at https://github.com/GenericMappingTools/pygmt/pull/525#discussion_r454414687 and https://github.com/GenericMappingTools/pygmt/pull/620#discussion_r493088431).

What we should do is to standardize how we want +n args to be written in the documentation. This is a bit complicated, but boils down to (at least) two options:

  1. r" **+n**\ *args* ". Use a raw-string in Python, allowing us to follow upstream GMT (as per https://github.com/GenericMappingTools/pygmt/pull/620#discussion_r493088431)

  2. " **+n**\\ *args* ". Use a double-backslash to avoid the flake8 error W605 invalid escape sequence '\ '.

An alternative would be to find a way to ignore the flake8 error somehow for the ReST docstrings.

Also, should we find a way to put these in code-formatted blocks (i.e. with backticks), as mentioned at https://github.com/GenericMappingTools/pygmt/pull/525/files#r454746311?

Are you willing to help implement and maintain this feature? Somewhat short on time, but will look into it.

References:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
maxrjonescommented, Feb 20, 2021

Moving forward is seems that the GMT documentation will be going with “[Default is …]” (see https://github.com/GenericMappingTools/gmt/pull/4834).

2reactions
seismancommented, Feb 23, 2021

As pointed out by @weiji14, the PyGMT documentation is inconsistently using italics, bold, and code strings.

I think we can following these conventions:

  1. Use code for Python function parameters
  2. Use bold and italics for GMT syntax like +nargs, in which bold +n means it should be typed as it is, and italic args should be given a specific value.

This is a good example of what it looks like (https://www.pygmt.org/dev/tutorials/frames.html):

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring PyGMT defaults
Default GMT parameters can be set globally or locally using pygmt.config . Note. This tutorial assumes the use of a Python notebook, such...
Read more >
Making your first figure - PyGMT
The mapping between the GMT parameters and their PyGMT aliases should be straightforward. For some modules, these aliases are still being developed. Parameters...
Read more >
First Steps with GMT/Python - PyGMT
This tutorial will get you started with the basic usage of GMT/Python. Some of the examples shown here are from the GMT Tutorial....
Read more >
Contributors Guide - PyGMT
Contributors Guide . This is a community driven project and everyone is welcome to contribute. The project is hosted at the PyGMT...
Read more >
pygmt.base_plotting
Full option list at :gmt-docs:`coast.html` {aliases} Parameters ---------- {J} ... scale (W) : float Multiply all z-values in the CPT by the provided...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found