Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Dec 6, 2020

Description of proposed changes

This PR implements the record-by-record transparency feature for Figure.text() function.

Example:

import pygmt
import numpy as np

x = np.arange(1, 10)
y = np.arange(11, 20)
text = [f"TEXT-{i}-{j}" for i, j in zip(x, y)]
transparency = np.arange(10, 100, 10)

fig = pygmt.Figure()
fig.basemap(region=[0, 10, 10, 20], projection="X10c", frame=True)
fig.text(x=x, y=y, text=text, transparency=transparency)
fig.show()

Output:

image

Fixes #615.

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 adding new functionality, add an example to docstrings or tutorials.

Notes

  • You can write /format in the first line of a comment to lint the code automatically

@seisman seisman added the feature Brand new feature label Dec 6, 2020
@seisman
Copy link
Member Author

seisman commented Dec 6, 2020

/format

@seisman seisman added this to the 0.3.0 milestone Dec 6, 2020
@seisman seisman marked this pull request as ready for review December 6, 2020 22:07
@seisman seisman requested a review from a team December 6, 2020 22:20
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Style checks are failing, and we really need to refactor this text function (along with #483).

pygmt/base_plotting.py:1377:4: R0914: Too many local variables (16/15) (too-many-locals)
pygmt/base_plotting.py:1377:4: R0912: Too many branches (13/12) (too-many-branches)

@seisman
Copy link
Member Author

seisman commented Dec 7, 2020

Style checks are failing, and we really need to refactor this text function (along with #483).

pygmt/base_plotting.py:1377:4: R0914: Too many local variables (16/15) (too-many-locals)
pygmt/base_plotting.py:1377:4: R0912: Too many branches (13/12) (too-many-branches)

Yes, let's leave it to future PRs.

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Ok then!

@seisman seisman merged commit fee246c into master Dec 7, 2020
@seisman seisman deleted the varying-transparency branch December 7, 2020 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Brand new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Varying transparency levels for plot, plot3d and text

4 participants