|
1 | 1 | """
|
2 |
| -Plotting Date Time Charts |
3 |
| -================ |
| 2 | +Plotting Datetime Charts |
| 3 | +======================== |
4 | 4 |
|
5 |
| -Plotting vectors is handled by :meth:`pygmt.Figure.basemap`. |
| 5 | +Plotting datetime charts is handled by :meth:`pygmt.Figure.basemap`. |
6 | 6 |
|
7 | 7 | .. note::
|
8 | 8 |
|
|
13 | 13 | To save the figure, use ``fig.savefig("figname.pdf")`` where ``"figname.pdf"``
|
14 | 14 | is the desired name and file extension for the saved figure.
|
15 | 15 | """
|
16 |
| -# sphinx_gallery_thumbnail_number = 6 |
| 16 | +# sphinx_gallery_thumbnail_number = 0 |
17 | 17 |
|
18 | 18 | import numpy as np
|
19 | 19 | import pygmt
|
20 | 20 |
|
21 |
| -######################################################################################### |
22 |
| -# Plot Cartesian Vectors |
| 21 | +######################################################################################## |
| 22 | +# Date - Time Formats into `fig.basemap` |
23 | 23 | # ----------------------
|
24 | 24 | #
|
25 |
| -# Create a simple Cartesian vector using a starting point through |
26 |
| -# ``x``, ``y``, and ``direction`` parameters. |
27 |
| -# On the shown figure, the plot is projected on a 10cm X 10cm region, |
28 |
| -# which is specified by the ``projection`` parameter. |
29 |
| -# The direction is specified |
30 |
| -# by a list of two 1d arrays structured as ``[[angle_in_degrees], [length]]``. |
31 |
| -# The angle is measured in degrees and moves counter-clockwise from the |
32 |
| -# horizontal. |
33 |
| -# The length of the vector uses centimeters by default but |
34 |
| -# could be changed using :meth:`pygmt.config` |
35 |
| -# (Check the next examples for unit changes). |
| 25 | +# Explanation of supported formats. |
| 26 | + |
| 27 | +######################################################################################## |
| 28 | +# `numpy.datetime64` |
| 29 | + |
| 30 | + |
| 31 | +# Code |
| 32 | + |
| 33 | +######################################################################################## |
| 34 | +# `pandas.DatetimeIndex` |
| 35 | + |
| 36 | +# Code |
| 37 | + |
| 38 | +######################################################################################## |
| 39 | +# `xarray.DataArray` |
| 40 | + |
| 41 | +# Code |
| 42 | + |
| 43 | +######################################################################################## |
| 44 | +# Raw date-time in ISO format |
| 45 | + |
| 46 | +# Code |
| 47 | + |
| 48 | +######################################################################################## |
| 49 | +# Python built-in: `datetime.datetime` |
| 50 | + |
| 51 | +# Code |
| 52 | + |
| 53 | +######################################################################################## |
| 54 | +# Python built-in: `datetime.date` |
| 55 | + |
| 56 | +# Code |
| 57 | + |
| 58 | +######################################################################################## |
| 59 | +# Using `pygmt.info` to get the min/max time for passing into the `region` parameter, |
| 60 | +# but note potential bug at #597. |
| 61 | +# ---------------------- |
36 | 62 | #
|
37 |
| -# Notice that the ``v`` in the ``style`` parameter stands for |
38 |
| -# vector; it distinguishes it from regular lines and allows for |
39 |
| -# different customization. ``0c`` is used to specify the size |
40 |
| -# of the arrow head which explains why there is no arrow on either |
41 |
| -# side of the vector. |
42 |
| - |
43 |
| -fig = pygmt.Figure() |
44 |
| -fig.plot( |
45 |
| - region=[0, 10, 0, 10], |
46 |
| - projection="X10c/10c", |
47 |
| - frame="ag", |
48 |
| - x=2, |
49 |
| - y=8, |
50 |
| - style="v0c", |
51 |
| - direction=[[-45], [6]], |
52 |
| -) |
53 |
| -fig.show() |
| 63 | +# Explanation of supported parameters + bug. |
| 64 | + |
| 65 | +# Code |
| 66 | + |
| 67 | +######################################################################################## |
| 68 | +# Setting Primary and Secondary Time Axes |
| 69 | +# ---------------------- |
| 70 | +# |
| 71 | +# Explanation. |
| 72 | + |
| 73 | +# Code |
0 commit comments