Skip to content

Commit

Permalink
Merge branch 'main' into add-tut-symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnefroehlich authored Nov 28, 2024
2 parents 28b7764 + 6766b84 commit d35af8b
Show file tree
Hide file tree
Showing 44 changed files with 383 additions and 200 deletions.
18 changes: 11 additions & 7 deletions .github/ISSUE_TEMPLATE/1-bug_report.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
name: Bug report
description: Report a problem/bug to help us improve
description: Report a problem/bug to help us improve.
labels: bug
body:
- type: markdown
attributes:
value: |
value: >
Thanks for taking the time to fill out this bug report!
- type: textarea
attributes:
label: "Description of the problem"
description: |
description: >
Please be as detailed as you can when describing an issue.
The more information we have, the easier it will be for us to track this down.
validations:
required: true
- type: textarea
attributes:
label: "Minimal Complete Verifiable Example"
description: |
description: >
So that we can understand and fix the issue quickly and efficiently, please provide
a minimal, self-contained copy-pastable example that demonstrates the issue.
For more details, check out:
- [Minimal Complete Verifiable Examples](https://stackoverflow.com/help/mcve)
- [Craft Minimal Bug Reports](https://matthewrocklin.com/minimal-bug-reports)
placeholder: "PASTE CODE HERE"
Expand All @@ -40,9 +42,11 @@ body:
- type: textarea
attributes:
label: "System information"
description: |
Please paste the output of `python -c "import pygmt; pygmt.show_versions()"`
If this command is not successful, please describe your operating system, how you installed PyGMT, how you installed GMT, and paste the full error message.
description: >
Please paste the output of `python -c "import pygmt; pygmt.show_versions()"`.
If this command is not successful, please describe your operating system,
how you installed PyGMT, how you installed GMT, and paste the full error message.
placeholder: "PASTE THE OUTPUT HERE"
render: bash
validations:
Expand Down
13 changes: 7 additions & 6 deletions .github/ISSUE_TEMPLATE/2-feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ body:
- type: textarea
attributes:
label: "Description of the desired feature"
description: |
Please be as detailed as you can in your description.
If possible, include an example of how you would like to use this feature (even better if it's a code example).
description: >
Please be as detailed as you can in your description. If possible, include
an example of how you would like to use this feature (even better if it's a code example).
- type: dropdown
id: help
attributes:
label: Are you willing to help implement and maintain this feature?
description: |
Every feature we add is code that we will have to maintain and keep updated. This takes a lot of effort.
If you are willing to be involved in the project and help maintain your feature, it will make it easier for us to accept it.
description: >
Every feature we add is code that we will have to maintain and keep updated.
This takes a lot of effort. If you are willing to be involved in the project and
help maintain your feature, it will make it easier for us to accept it.
options:
- "No"
- "Yes"
Expand Down
25 changes: 16 additions & 9 deletions .github/ISSUE_TEMPLATE/3-module_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@ labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
Please replace `<module-name>` in the issue title and the description with the name of the requested module and add the description of the module.
value: >
Please replace `<module-name>` in the issue title and the description with the
name of the requested module and add the description of the module.
- type: textarea
id: which-module
attributes:
label: Description of the desired module
description: Please be as detailed as you can in your description. If possible, include an example of how you would like to use this feature (even better if it's a code example).
placeholder: Implement [`<module-name>`](https://docs.generic-mapping-tools.org/latest/<module-name>.html) which `<insert description of the GMT module>`.
description: >
Please be as detailed as you can in your description. If possible, include
an example of how you would like to use this feature (even better if it's a code example).
placeholder: >
Implement [`<module-name>`](https://docs.generic-mapping-tools.org/latest/<module-name>.html)
which `<insert description of the GMT module>`.
validations:
required: true
- type: dropdown
id: help
attributes:
label: Are you willing to help implement and maintain this feature?
description: |
Every feature we add is code that we will have to maintain and keep updated. This takes a lot of effort.
If you are willing to be involved in the project and help maintain your feature, it will make it easier for us to accept it.
description: >
Every feature we add is code that we will have to maintain and keep updated.
This takes a lot of effort. If you are willing to be involved in the project and
help maintain your feature, it will make it easier for us to accept it.
options:
- "No"
- "Yes"
Expand All @@ -30,5 +36,6 @@ body:
required: true
- type: markdown
attributes:
value: |
Progress on wrapping the module will be tracked in the [project board](https://github.com/GenericMappingTools/pygmt/projects/9).
value: >
Progress on wrapping the module will be tracked in the
[project board](https://github.com/orgs/GenericMappingTools/projects/3).
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cache_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_doctests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down Expand Up @@ -142,7 +142,6 @@ jobs:
pytest-doctestplus
pytest-mpl
pytest-rerunfailures
pytest-xdist
# Download cached remote files (artifacts) from GitHub
- name: Download remote data from GitHub
Expand All @@ -165,7 +164,7 @@ jobs:

# Run the regular tests
- name: Run tests
run: make test PYTEST_EXTRA="-r P -n auto --reruns 2"
run: make test PYTEST_EXTRA="-r P --reruns 2"

# Upload diff images on test failure
- name: Upload diff images if any test fails
Expand All @@ -177,7 +176,7 @@ jobs:

# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/[email protected].3
uses: codecov/[email protected].7
if: success() || failure()
with:
use_oidc: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
numpy pandas xarray netCDF4 packaging \
build contextily dvc geopandas ipython pyarrow rioxarray \
pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures pytest-xdist\
pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures \
sphinx-gallery
# Show installed pkg information for postmortem diagnostic
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:

# Run the tests
- name: Test with pytest
run: make test PYTEST_EXTRA="-r P -n auto --reruns 2"
run: make test PYTEST_EXTRA="-r P --reruns 2"
env:
GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests_legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected].1
uses: mamba-org/[email protected].2
with:
environment-name: pygmt
condarc: |
Expand Down
6 changes: 2 additions & 4 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ server:
clean:
rm -rf $(BUILDDIR)
rm -rf api/generated
rm -rf intro
rm -rf tutorials
rm -rf gallery
rm -rf projections
rm -rf intro tutorials gallery projections
rm -rf sg_execution_times.rst
79 changes: 42 additions & 37 deletions examples/gallery/histograms/scatter_and_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,75 @@
Scatter plot with histograms
============================
To create a scatter plot with histograms at the sides of the plot one
can use :meth:`pygmt.Figure.plot` in combination with
:meth:`pygmt.Figure.histogram`. The positions of the histograms are plotted
by offsetting them from the main scatter plot figure using
:meth:`pygmt.Figure.shift_origin`.
To create a scatter plot with histograms at the sides of the plot one can use
:meth:`pygmt.Figure.plot` in combination with :meth:`pygmt.Figure.histogram`. The
positions of the histograms are plotted by offsetting them from the main scatter plot
using :meth:`pygmt.Figure.shift_origin`.
"""

# %%
import numpy as np
import pygmt

# Generate random data from a standard normal distribution centered on 0
# with a standard deviation of 1
rng = np.random.default_rng(seed=19680801)
# Generate random x, y coordinates from a standard normal distribution.
# x values are centered on 0 with a standard deviation of 1, and y values are centered
# on 30 with a standard deviation of 2.
rng = np.random.default_rng()
x = rng.normal(loc=0, scale=1, size=1000)
y = rng.normal(loc=0, scale=1, size=1000)
y = rng.normal(loc=30, scale=2, size=1000)

# Get axis limits
xymax = max(np.max(np.abs(x)), np.max(np.abs(y)))
# Get axis limits from the data limits. Extend the limits by 0.5 to add some margin.
xmin = np.floor(x.min()) - 0.5
xmax = np.ceil(x.max()) + 0.5
ymin = np.floor(y.min()) - 0.5
ymax = np.ceil(y.max()) + 0.5

# Set fill color for symbols and bars.
fill = "seagreen"

# Set the dimensions of the scatter plot.
width, height = 10, 8

fig = pygmt.Figure()
fig.basemap(
region=[-xymax - 0.5, xymax + 0.5, -xymax - 0.5, xymax + 0.5],
projection="X10c/10c",
frame=["WSrt", "a1"],
region=[xmin, xmax, ymin, ymax],
projection=f"X{width}/{height}",
frame=["WSrt", "af"],
)

fillcol = "seagreen"

# Plot data points as circles with a diameter of 0.15 centimeters
fig.plot(x=x, y=y, style="c0.15c", fill=fillcol, transparency=50)
# Plot data points as circles with a diameter of 0.15 centimeters and set transparency
# level for all circles to deal with overplotting.
fig.plot(x=x, y=y, style="c0.15c", fill=fill, transparency=50)

# Shift the plot origin and add top margin histogram
fig.shift_origin(yshift="10.25c")
# Shift the plot origin and add top margin histogram.
fig.shift_origin(yshift=height + 0.25)

fig.histogram(
projection="X10c/2c",
frame=["Wsrt", "xf1", "y+lCounts"],
# Give the same value for ymin and ymax to have ymin and ymax
# calculated automatically
region=[-xymax - 0.5, xymax + 0.5, 0, 0],
projection=f"X{width}/3",
frame=["Wsrt", "xf", "yaf+lCounts"],
# Give the same value for ymin and ymax to have them calculated automatically.
region=[xmin, xmax, 0, 0],
data=x,
fill=fillcol,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.1,
series=0.2,
)

# Shift the plot origin and add right margin histogram
fig.shift_origin(yshift="-10.25c", xshift="10.25c")
# Shift the plot origin and add right margin histogram.
fig.shift_origin(yshift=-height - 0.25, xshift=width + 0.25)

# Plot the horizontal histogram.
fig.histogram(
horizontal=True,
projection="X2c/10c",
# Note that the y-axis annotation "Counts" is shown in x-axis direction
# due to the rotation caused by horizontal=True
frame=["wSrt", "xf1", "y+lCounts"],
region=[-xymax - 0.5, xymax + 0.5, 0, 0],
projection=f"X3/{height}",
# Note that the x- and y-axis are flipped, with the y-axis plotted horizontally.
frame=["wSrt", "xf", "yaf+lCounts"],
region=[ymin, ymax, 0, 0],
data=y,
fill=fillcol,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.1,
series=0.2,
)

fig.show()
5 changes: 2 additions & 3 deletions examples/tutorials/advanced/cartesian_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@
fill="red3",
pen="1p,darkgray,solid",
histtype=0,
# Use horizontal bars
# Please note the flip of the x and y axes regarding annotations, ticks, gridlines,
# and labels
# Use horizontal bars. Note that the x- and y-axis are flipped, with the x-axis
# plotted vertically and the y-axis plotted horizontally.
horizontal=True,
)

Expand Down
Loading

0 comments on commit d35af8b

Please sign in to comment.