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

Better support for plotting text in 3D at different heights #1393

Open
weiji14 opened this issue Jul 23, 2021 · 0 comments
Open

Better support for plotting text in 3D at different heights #1393

weiji14 opened this issue Jul 23, 2021 · 0 comments
Labels
feature request New feature wanted good first issue Good for newcomers help wanted Helping hands are appreciated

Comments

@weiji14
Copy link
Member

weiji14 commented Jul 23, 2021

Description of the desired feature

For 3D plots, it should be possible to plot text at different heights based on a 'z' column, see https://docs.generic-mapping-tools.org/6.2/text.html#z. The current implementation of text in PyGMT (see https://www.pygmt.org/v0.4.0/api/generated/pygmt.Figure.text.html) does support this, but users have to provide the xyz input into the textfiles parameter, and it is also not very discoverable for new users.

It would be nice to have a z parameter (in addition to x and y) to be clear that text does support multi-height plotting. Here's a checklist for anyone wanting to work on this 'enhancement'.

TODO:

  1. Alias the -Z, call it zvalue (as in plot3d)?
  2. Add the z parameter here:

    pygmt/pygmt/src/text.py

    Lines 48 to 49 in 945bbc5

    x=None,
    y=None,
  3. Modify the code here to mention that x/y/z triples are also possible (need to wait for Refactor text to use virtualfile_from_data #1121 though edit: done!):

    pygmt/pygmt/src/text.py

    Lines 160 to 170 in 945bbc5

    if position is None:
    kind = data_kind(textfiles, x, y, text)
    else:
    if x is not None or y is not None:
    raise GMTInvalidInput(
    "Provide either position only, or x/y pairs, not both"
    )
    kind = "vectors"
    if kind == "vectors" and text is None:
    raise GMTInvalidInput("Must provide text with x/y pairs or position")
  4. Update the text API docstring to document the new behaviour.
  5. (Optional) Update the tutorial at https://www.pygmt.org/v0.4.0/tutorials/text.html to mention that z-value inputs are supported too.

Are you willing to help implement and maintain this feature? Please wait for #1121 before starting work on this (Edit: that PR is merged, so ready to start)!

@weiji14 weiji14 added the feature request New feature wanted label Jul 23, 2021
@weiji14 weiji14 added this to the 0.5.0 milestone Jul 23, 2021
@weiji14 weiji14 added the help wanted Helping hands are appreciated label Sep 21, 2021
@weiji14 weiji14 modified the milestones: 0.5.0, 0.6.0 Sep 30, 2021
@weiji14 weiji14 modified the milestones: 0.6.0, 0.7.0 Mar 1, 2022
@seisman seisman modified the milestones: 0.7.0, 0.8.0 Jun 17, 2022
@seisman seisman modified the milestones: 0.8.0, 0.9.0 Dec 11, 2022
@weiji14 weiji14 removed this from the 0.9.0 milestone Mar 6, 2023
@weiji14 weiji14 added the good first issue Good for newcomers label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted good first issue Good for newcomers help wanted Helping hands are appreciated
Projects
None yet
Development

No branches or pull requests

2 participants