Skip to content

Update parameter 'color' to 'fill' in examples and tutorials #2201

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 34 commits into from
Nov 25, 2022

Conversation

michaelgrund
Copy link
Member

Addresses #1617

Description of proposed changes

Fixes #

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

@michaelgrund michaelgrund added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog labels Nov 22, 2022
@michaelgrund michaelgrund added this to the 0.8.0 milestone Nov 22, 2022
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Nov 22, 2022
@yvonnefroehlich
Copy link
Member

Hmm. There seem to be some gallery examples left, which still use the parameter name color (with pygmt.Figure.plot). Or is this renaming split into two or multiple PRs? Probably also some renaming has to be done for the tutorials.

/cygdrive/c/users/Admin/C2/EigeneDokumente/Studium/Promotion/01_GitHub/github_pygmt/pygmt/examples/gallery
$ git branch
  add-colorbars-examples
  fix-alias-list-docs-triangulate
* gallery-color-to-fill
  main
  sphinx-paramlinks

/cygdrive/c/users/Admin/C2/EigeneDokumente/Studium/Promotion/01_GitHub/github_pygmt/pygmt/examples/gallery
$ grep 'color=' */*.py
3d_plots/scatter3d.py:    color=df.species.cat.codes.astype(int),
basemaps/double_y_axes.py:fig.plot(x=x, y=y1, style="c0.2c", color="blue", label="y1")
basemaps/double_y_axes.py:fig.plot(x=x, y=y2, style="s0.28c", color="red", label="y2")
embellishments/legend.py:    color="lightgreen",
embellishments/legend.py:fig.plot(data="@Table_5_11.txt", style="t0.40c", color="orange", label="Oranges")
histograms/blockm.py:    x=data.longitude, y=data.latitude, style="c0.3c", color="white", pen="1p,black"
histograms/blockm.py:    x=data.longitude, y=data.latitude, style="c0.3c", color="white", pen="1p,black"
images/track_sampling.py:    color=(track.bathymetry - track.bathymetry.mean()) / track.bathymetry.std(),
lines/wiggle.py:    color=["red+p", "gray+n"],
seismology/velo_arrow_ellipse.py:    uncertaintycolor="lightblue1",
symbols/bars.py:        fig.plot(x=1, y=2, style="b0.5c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=2, y=2.5, style="b1c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3, y=2.5, style="b0.75c+b1", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=1.5, y=0.5, style="B0.75c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3, y=1.5, style="B1c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3.5, y=2.5, style="B0.5c+b2", color=color, pen=pen)
symbols/points.py:fig.plot(x=x, y=y, style="i0.5c", color="black")
symbols/points_categorical.py:``color=df.species.cat.codes.astype(int)``. Additionally, we have to set
symbols/points_transparency.py:fig.plot(x=x, y=y, style="c0.6c", color="blue", pen="1p,red", transparency=transparency)
symbols/scatter.py:        color=color,
symbols/text_symbols.py:fig.plot(x=1, y=1.5, style="l3.5c+tA", color="dodgerblue3", pen=pen)
symbols/text_symbols.py:fig.plot(x=2.5, y=1, style="l3.5c+t*", color="red3", pen=pen)
symbols/text_symbols.py:fig.plot(x=4, y=1.5, style="l3.5c+tZ+fCourier-Bold", color="seagreen", pen=pen)
symbols/text_symbols.py:fig.plot(x=5.5, y=1.5, style="l3.5c+ts+fTimes-Italic", color="gold", pen=pen)
symbols/text_symbols.py:fig.plot(x=7, y=1.5, style="l3.5c+t\160+fSymbol,darkorange", color="magenta4", pen=pen)

@michaelgrund
Copy link
Member Author

Hmm. There seem to be some gallery examples left, which still use the parameter name color (with pygmt.Figure.plot). Or is this renaming split into two or multiple PRs? Probably also some renaming has to be done for the tutorials.

/cygdrive/c/users/Admin/C2/EigeneDokumente/Studium/Promotion/01_GitHub/github_pygmt/pygmt/examples/gallery
$ git branch
  add-colorbars-examples
  fix-alias-list-docs-triangulate
* gallery-color-to-fill
  main
  sphinx-paramlinks

/cygdrive/c/users/Admin/C2/EigeneDokumente/Studium/Promotion/01_GitHub/github_pygmt/pygmt/examples/gallery
$ grep 'color=' */*.py
3d_plots/scatter3d.py:    color=df.species.cat.codes.astype(int),
basemaps/double_y_axes.py:fig.plot(x=x, y=y1, style="c0.2c", color="blue", label="y1")
basemaps/double_y_axes.py:fig.plot(x=x, y=y2, style="s0.28c", color="red", label="y2")
embellishments/legend.py:    color="lightgreen",
embellishments/legend.py:fig.plot(data="@Table_5_11.txt", style="t0.40c", color="orange", label="Oranges")
histograms/blockm.py:    x=data.longitude, y=data.latitude, style="c0.3c", color="white", pen="1p,black"
histograms/blockm.py:    x=data.longitude, y=data.latitude, style="c0.3c", color="white", pen="1p,black"
images/track_sampling.py:    color=(track.bathymetry - track.bathymetry.mean()) / track.bathymetry.std(),
lines/wiggle.py:    color=["red+p", "gray+n"],
seismology/velo_arrow_ellipse.py:    uncertaintycolor="lightblue1",
symbols/bars.py:        fig.plot(x=1, y=2, style="b0.5c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=2, y=2.5, style="b1c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3, y=2.5, style="b0.75c+b1", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=1.5, y=0.5, style="B0.75c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3, y=1.5, style="B1c", color=color, pen=pen)
symbols/bars.py:        fig.plot(x=3.5, y=2.5, style="B0.5c+b2", color=color, pen=pen)
symbols/points.py:fig.plot(x=x, y=y, style="i0.5c", color="black")
symbols/points_categorical.py:``color=df.species.cat.codes.astype(int)``. Additionally, we have to set
symbols/points_transparency.py:fig.plot(x=x, y=y, style="c0.6c", color="blue", pen="1p,red", transparency=transparency)
symbols/scatter.py:        color=color,
symbols/text_symbols.py:fig.plot(x=1, y=1.5, style="l3.5c+tA", color="dodgerblue3", pen=pen)
symbols/text_symbols.py:fig.plot(x=2.5, y=1, style="l3.5c+t*", color="red3", pen=pen)
symbols/text_symbols.py:fig.plot(x=4, y=1.5, style="l3.5c+tZ+fCourier-Bold", color="seagreen", pen=pen)
symbols/text_symbols.py:fig.plot(x=5.5, y=1.5, style="l3.5c+ts+fTimes-Italic", color="gold", pen=pen)
symbols/text_symbols.py:fig.plot(x=7, y=1.5, style="l3.5c+t\160+fSymbol,darkorange", color="magenta4", pen=pen)

This PR is still WIP. Changed it to draft until it's done!

@michaelgrund michaelgrund marked this pull request as draft November 22, 2022 13:44
@yvonnefroehlich yvonnefroehlich removed the final review call This PR requires final review and approval from a second reviewer label Nov 22, 2022
@yvonnefroehlich
Copy link
Member

yvonnefroehlich commented Nov 22, 2022

This PR is still WIP. Changed it to draft until it's done!

Sounds good 🙂.
I apologize @michaelgrund! Unfortunately, I only looked at the finale review call label. I removed it.

@michaelgrund michaelgrund marked this pull request as ready for review November 23, 2022 09:44
@michaelgrund michaelgrund added the needs review This PR has higher priority and needs review. label Nov 23, 2022
@seisman
Copy link
Member

seisman commented Nov 23, 2022

Some failures:

Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/lines/wiggle.py", line 22, in <module>
    fig.wiggle(
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 594, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 734, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/src/wiggle.py", line 105, in wiggle
    module="wiggle", args=build_arg_string(kwargs, infile=fname)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/utils.py", line 212, in build_arg_string
    raise GMTInvalidInput(f"Unrecognized parameter '{key}'.")
pygmt.exceptions.GMTInvalidInput: Unrecognized parameter 'fill'.


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py", line 36, in <module>
    label=f"{color}+S0.25c",
NameError: name 'color' is not defined


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py", line 41, in <module>
    fig.plot(x=1, y=2, style="b0.5c", fill=color, pen=pen)
NameError: name 'color' is not defined

@michaelgrund
Copy link
Member Author

Some failures:

Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/lines/wiggle.py", line 22, in <module>
    fig.wiggle(
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 594, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 734, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/src/wiggle.py", line 105, in wiggle
    module="wiggle", args=build_arg_string(kwargs, infile=fname)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/utils.py", line 212, in build_arg_string
    raise GMTInvalidInput(f"Unrecognized parameter '{key}'.")
pygmt.exceptions.GMTInvalidInput: Unrecognized parameter 'fill'.


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py", line 36, in <module>
    label=f"{color}+S0.25c",
NameError: name 'color' is not defined


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py", line 41, in <module>
    fig.plot(x=1, y=2, style="b0.5c", fill=color, pen=pen)
NameError: name 'color' is not defined

To fix the warnings regarding Figure.wiggle, first #2205 needs to be merged.

@seisman
Copy link
Member

seisman commented Nov 24, 2022

Some failures:

Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/lines/wiggle.py", line 22, in <module>
    fig.wiggle(
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 594, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/decorators.py", line 734, in new_module
    return module_func(*args, **kwargs)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/src/wiggle.py", line 105, in wiggle
    module="wiggle", args=build_arg_string(kwargs, infile=fname)
  File "/Users/runner/miniconda3/envs/pygmt/lib/python3.10/site-packages/pygmt/helpers/utils.py", line 212, in build_arg_string
    raise GMTInvalidInput(f"Unrecognized parameter '{key}'.")
pygmt.exceptions.GMTInvalidInput: Unrecognized parameter 'fill'.


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/scatter.py", line 36, in <module>
    label=f"{color}+S0.25c",
NameError: name 'color' is not defined


/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py failed leaving traceback:
Traceback (most recent call last):
  File "/Users/runner/work/pygmt/pygmt/examples/gallery/symbols/bars.py", line 41, in <module>
    fig.plot(x=1, y=2, style="b0.5c", fill=color, pen=pen)
NameError: name 'color' is not defined

To fix the warnings regarding Figure.wiggle, first #2205 needs to be merged.

I think you can revert the changes for Figure.wiggle and Figure.velo, and make the changes in PR #2205 and #2206 instead.

@michaelgrund
Copy link
Member Author

/format

@michaelgrund
Copy link
Member Author

/format

@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Nov 24, 2022
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.

Looks good.

@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Nov 25, 2022
@seisman seisman merged commit 89916b6 into main Nov 25, 2022
@seisman seisman deleted the gallery-color-to-fill branch November 25, 2022 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants