From 27e0ac5dca30ee822077838e56b83eab63187e92 Mon Sep 17 00:00:00 2001 From: Justin Kunimune Date: Tue, 1 Oct 2024 13:46:18 -0400 Subject: [PATCH] Clarify input dimensions for pcolormesh The tutorial states that the `x`, `y`, and `data` inputs to pcolormesh should be of the same size, but that's not correct. As per the `Basemap.pcolormesh` docstring, `x` and `y` should have dimensions one greater than those of data; the code will still run if they have the same size but the last row and column get dropped. --- docs/plotting_data.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/plotting_data.rst b/docs/plotting_data.rst index 57b283b..e71827c 100644 --- a/docs/plotting_data.rst +++ b/docs/plotting_data.rst @@ -210,11 +210,14 @@ Creates a pseudo-color plot `pcolormesh(x, y, data, *args, **kwargs) `_ -* x and y are matrices of the same size as data, containing the positions of the elements in the map coordinates +* x and y are matrices containing the positions of the elements in the map coordinates * data is the matrix containing the data values to plot * The default colormap is *jet*, but the argument *cmap* can be used to change the behavior * Other possible arguments are documented in the `matplotlib function docs `__ +Note that ideally the dimensions of x and y should be one greater than those of data; +if the dimensions are the same, then the last row and column of data will be ignored. + .. literalinclude:: ../code_examples/basic_functions/pcolormesh.py :emphasize-lines: 22 .. image:: images/basic_functions/pcolormesh.png @@ -347,4 +350,4 @@ The text can have many many options such as: .. image:: images/plotting_data/text.png -To draw a text label with an arrow, use :ref:`annotate`. \ No newline at end of file +To draw a text label with an arrow, use :ref:`annotate`.