Skip to content

Commit be38d78

Browse files
Improve the gallery example for datetime inputs (#919)
Co-authored-by: Dongdong Tian <[email protected]>
1 parent dc1671e commit be38d78

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

examples/gallery/plot/datetime-inputs.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
- :class:`numpy.datetime64`
88
- :class:`pandas.DatetimeIndex`
99
- :class:`xarray.DataArray`: datetimes included in a *xarray.DataArray*
10-
- raw datetime strings in `ISO format <https://en.wikipedia.org/wiki/ISO_8601>`__ (e.g. ``"YYYY-MM-DD"``, ``"YYYY-MM-DDTHH"``, and ``"YYYY-MM-DDTHH:MM:SS"``)
10+
- raw datetime strings in `ISO format <https://en.wikipedia.org/wiki/ISO_8601>`__
11+
(e.g. ``"YYYY-MM-DD"``, ``"YYYY-MM-DDTHH"``, and ``"YYYY-MM-DDTHH:MM:SS"``)
1112
- Python built-in :class:`datetime.datetime` and :class:`datetime.date`
1213
13-
We can pass datetime inputs based on one of the types listed above directly to the ``x`` and ``y`` arguments
14-
of e.g. the :meth:`pygmt.Figure.plot` method:
14+
We can pass datetime inputs based on one of the types listed above directly to
15+
the ``x`` and ``y`` parameters of e.g. the :meth:`pygmt.Figure.plot` method.
1516
16-
The ``region`` argument has to include the :math:`x` and :math:`y` axis limits as *str* in the form
17-
*date_min/date_max/ymin/ymax*.
17+
The ``region`` parameter has to include the :math:`x` and :math:`y` axis limits
18+
in the form [*date_min*, *date_max*, *ymin*, *ymax*]. Here *date_min* and
19+
*date_max* can be directly defined as datetime input.
1820
1921
"""
2022

@@ -30,7 +32,9 @@
3032
# create a basemap with limits of 2010-01-01 to 2020-06-01 on the x axis and
3133
# 0 to 10 on the y axis
3234
fig.basemap(
33-
projection="X15c/5c", region="2010-01-01/2020-06-01/0/10", frame=["WSen", "af"]
35+
projection="X15c/5c",
36+
region=[datetime.date(2010, 1, 1), datetime.date(2020, 6, 1), 0, 10],
37+
frame=["WSen", "af"],
3438
)
3539

3640
# numpy.datetime64 types

0 commit comments

Comments
 (0)