From 1b6d902cbada926790c4e825d7f538edfc19ed47 Mon Sep 17 00:00:00 2001 From: Jan Caron <j.caron@fz-juelich.de> Date: Tue, 17 Mar 2020 10:10:56 +0100 Subject: [PATCH] Short docu that y-axis is flipped for image plots due to origin being lower, not higher as is default in maptlotlib --- docs/vis.rst | 3 +++ src/empyre/vis/plot2d.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/vis.rst b/docs/vis.rst index 9d0d311..517d646 100644 --- a/docs/vis.rst +++ b/docs/vis.rst @@ -3,6 +3,9 @@ The vis visualization submodule General empyre.vis docu here! +Note that the y-axis of all image plots is flipped in comparison to ``matplotlib.pyplot.imshow``, i.e. that the +origin is `'lower'` in this case instead of `'upper'`. + The plot2d module ----------------- diff --git a/src/empyre/vis/plot2d.py b/src/empyre/vis/plot2d.py index c86ed0f..2c6b6c3 100644 --- a/src/empyre/vis/plot2d.py +++ b/src/empyre/vis/plot2d.py @@ -50,7 +50,9 @@ def imshow(field, axis=None, cmap=None, **kwargs): Notes ----- - Additional kwargs are passed to `matplotlib.pyplot.imshow`. + Additional kwargs are passed to :function:`~matplotlib.pyplot.imshow`. + Note that the y-axis of the plot is flipped in comparison to :function:`~matplotlib.pyplot.imshow`, i.e. that the + origin is `'lower'` in this case instead of `'upper'`. Uses the `empyre-image` stylesheet settings for plotting (and axis creation if none exists, yet). Fields are squeezed before plotting, so non-2D fields work as long as their superfluous dimensions have length 1. @@ -114,6 +116,8 @@ def contour(field, axis=None, **kwargs): Notes ----- Additional kwargs are passed to `matplotlib.pyplot.contour`. + Note that the y-axis of the plot is flipped in comparison to :function:`~matplotlib.pyplot.imshow`, i.e. that the + origin is `'lower'` in this case instead of `'upper'`. Uses the `empyre-image` stylesheet settings for plotting (and axis creation if none exists, yet). Fields are squeezed before plotting, so non-2D fields work as long as their superfluous dimensions have length 1. @@ -164,6 +168,8 @@ def colorvec(field, axis=None, **kwargs): Notes ----- Additional kwargs are passed to `matplotlib.pyplot.imshow`. + Note that the y-axis of the plot is flipped in comparison to :function:`~matplotlib.pyplot.imshow`, i.e. that the + origin is `'lower'` in this case instead of `'upper'`. Uses the `empyre-image` stylesheet settings for plotting (and axis creation if none exists, yet). Fields are squeezed before plotting, so non-2D fields work as long as their superfluous dimensions have length 1. Even though squeezing takes place, `colorvec` "remembers" the original orientation of the slice! This is important -- GitLab