diff --git a/examples/gallery/plot/datetime-inputs.py b/examples/gallery/plot/datetime-inputs.py index 33c88ba7cf5..4851b337484 100644 --- a/examples/gallery/plot/datetime-inputs.py +++ b/examples/gallery/plot/datetime-inputs.py @@ -7,14 +7,16 @@ - :class:`numpy.datetime64` - :class:`pandas.DatetimeIndex` - :class:`xarray.DataArray`: datetimes included in a *xarray.DataArray* -- raw datetime strings in `ISO format `__ (e.g. ``"YYYY-MM-DD"``, ``"YYYY-MM-DDTHH"``, and ``"YYYY-MM-DDTHH:MM:SS"``) +- raw datetime strings in `ISO format `__ + (e.g. ``"YYYY-MM-DD"``, ``"YYYY-MM-DDTHH"``, and ``"YYYY-MM-DDTHH:MM:SS"``) - Python built-in :class:`datetime.datetime` and :class:`datetime.date` -We can pass datetime inputs based on one of the types listed above directly to the ``x`` and ``y`` arguments -of e.g. the :meth:`pygmt.Figure.plot` method: +We can pass datetime inputs based on one of the types listed above directly to +the ``x`` and ``y`` parameters of e.g. the :meth:`pygmt.Figure.plot` method. -The ``region`` argument has to include the :math:`x` and :math:`y` axis limits as *str* in the form -*date_min/date_max/ymin/ymax*. +The ``region`` parameter has to include the :math:`x` and :math:`y` axis limits +in the form [*date_min*, *date_max*, *ymin*, *ymax*]. Here *date_min* and +*date_max* can be directly defined as datetime input. """ @@ -30,7 +32,9 @@ # create a basemap with limits of 2010-01-01 to 2020-06-01 on the x axis and # 0 to 10 on the y axis fig.basemap( - projection="X15c/5c", region="2010-01-01/2020-06-01/0/10", frame=["WSen", "af"] + projection="X15c/5c", + region=[datetime.date(2010, 1, 1), datetime.date(2020, 6, 1), 0, 10], + frame=["WSen", "af"], ) # numpy.datetime64 types