We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
quick2D returns transposed plot
`artists.quick2D` uses the overloaded `ax.pcolor` and `ax.contourf` to plot arrays--- see [here](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists/_quick.py#L252). 

However, `ax.contourf` does not properly handle the arrays. I think the problem is [line255](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists/_base.py#L255). I think `zi` should instead be `zi.T` to handle the way matplotlib indexes arrays. 
 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `WrightTools/artists/_quick.py`
Content:
```
1 """Quick plotting."""
2 
3 
4 # --- import --------------------------------------------------------------------------------------
5 
6 
7 import os
8 
9 import numpy as np
10 
11 import matplotlib.pyplot as plt
12 
13 from ._helpers import create_figure, plot_colorbar, savefig
14 from ._colors import colormaps
15 from .. import kit as wt_kit
16 
17 
18 # --- define --------------------------------------------------------------------------------------
19 
20 
21 __all__ = ['quick1D', 'quick2D']
22 
23 
24 # --- general purpose plotting functions ----------------------------------------------------------
25 
26 
27 def quick1D(data, axis=0, at={}, channel=0, *, local=False, autosave=False, save_directory=None,
28             fname=None, verbose=True):
29     """Quickly plot 1D slice(s) of data.
30 
31     Parameters
32     ----------
33     data : WrightTools.Data object
34         Data to plot.
35     axis : string or integer (optional)
36         Expression or index of axis. Default is 0.
37     at : dictionary (optional)
38         Dictionary of parameters in non-plotted dimension(s). If not
39         provided, plots will be made at each coordinate.
40     channel : string or integer (optional)
41         Name or index of channel to plot. Default is 0.
42     local : boolean (optional)
43         Toggle plotting locally. Default is False.
44     autosave : boolean (optional)
45          Toggle autosave. Default is False.
46     save_directory : string (optional)
47          Location to save image(s). Default is None (auto-generated).
48     fname : string (optional)
49          File name. If None, data name is used. Default is None.
50     verbose : boolean (optional)
51         Toggle talkback. Default is True.
52 
53     Returns
54     -------
55     list of strings
56         List of saved image files (if any).
57     """
58     # prepare data
59     chopped = data.chop(axis, at=at, verbose=False)
60     # channel index
61     channel_index = wt_kit.get_index(data.channel_names, channel)
62     # prepare figure
63     fig = None
64     if len(chopped) > 10:
65         if not autosave:
66             print('more than 10 images will be generated: forcing autosave')
67             autosave = True
68     # prepare output folders
69     if autosave:
70         if save_directory:
71             pass
72         else:
73             if len(chopped) == 1:
74                 save_directory = os.getcwd()
75                 if fname:
76                     pass
77                 else:
78                     fname = data.natural_name
79             else:
80                 folder_name = 'mpl_1D ' + wt_kit.TimeStamp().path
81                 os.mkdir(folder_name)
82                 save_directory = folder_name
83     # chew through image generation
84     out = []
85     for i, d in enumerate(chopped.values()):
86         # unpack data -----------------------------------------------------------------------------
87         axis = d.axes[0]
88         xi = axis.full
89         channel = d.channels[channel_index]
90         zi = channel[:]
91         # create figure ---------------------------------------------------------------------------
92         aspects = [[[0, 0], 0.5]]
93         fig, gs = create_figure(width='single', nrows=1, cols=[1], aspects=aspects)
94         ax = plt.subplot(gs[0, 0])
95         # plot ------------------------------------------------------------------------------------
96         plt.plot(xi, zi, lw=2)
97         plt.scatter(xi, zi, color='grey', alpha=0.5, edgecolor='none')
98         # decoration ------------------------------------------------------------------------------
99         plt.grid()
100         # limits
101         if local:
102             pass
103         else:
104             data_channel = data.channels[channel_index]
105             plt.ylim(data_channel.min(), data_channel.max())
106         # label axes
107         ax.set_xlabel(axis.label, fontsize=18)
108         ax.set_ylabel(channel.name, fontsize=18)
109         plt.xticks(rotation=45)
110         plt.xlim(xi.min(), xi.max())
111         # save ------------------------------------------------------------------------------------
112         if autosave:
113             if fname:
114                 file_name = fname + ' ' + str(i).zfill(3)
115             else:
116                 file_name = str(i).zfill(3)
117             fpath = os.path.join(save_directory, file_name + '.png')
118             savefig(fpath, fig=fig)
119             plt.close()
120             if verbose:
121                 print('image saved at', fpath)
122             out.append(fpath)
123     return out
124 
125 
126 def quick2D(data, xaxis=1, yaxis=0, at={}, channel=0, *, contours=0, pixelated=True,
127             dynamic_range=False, local=False, contours_local=True, autosave=False,
128             save_directory=None, fname=None, verbose=True):
129     """Quickly plot 2D slice(s) of data.
130 
131     Parameters
132     ----------
133     data : WrightTools.Data object.
134         Data to plot.
135     xaxis : string or integer (optional)
136         Expression or index of horizontal axis. Default is 1.
137     yaxis : string or integer (optional)
138         Expression or index of vertical axis. Default is 0.
139     at : dictionary (optional)
140         Dictionary of parameters in non-plotted dimension(s). If not
141         provided, plots will be made at each coordinate.
142     channel : string or integer (optional)
143         Name or index of channel to plot. Default is 0.
144     contours : integer (optional)
145         The number of black contour lines to add to the plot. Default is 0.
146     pixelated : boolean (optional)
147         Toggle between pcolor and contourf (deulaney) plotting backends.
148         Default is True (pcolor).
149     dynamic_range : boolean (optional)
150         Force the colorbar to use all of its colors. Only changes behavior
151         for signed channels. Default is False.
152     local : boolean (optional)
153         Toggle plotting locally. Default is False.
154     contours_local : boolean (optional)
155         Toggle plotting black contour lines locally. Default is True.
156     autosave : boolean (optional)
157          Toggle autosave. Default is False.
158     save_directory : string (optional)
159          Location to save image(s). Default is None (auto-generated).
160     fname : string (optional)
161          File name. If None, data name is used. Default is None.
162     verbose : boolean (optional)
163         Toggle talkback. Default is True.
164 
165     Returns
166     -------
167     list of strings
168         List of saved image files (if any).
169     """
170     # prepare data
171     chopped = data.chop(xaxis, yaxis, at=at, verbose=False)
172     # channel index
173     channel_index = wt_kit.get_index(data.channel_names, channel)
174     # colormap
175     # get colormap
176     if data.channels[channel_index].signed:
177         cmap = 'signed'
178     else:
179         cmap = 'default'
180     cmap = colormaps[cmap]
181     cmap.set_bad([0.75] * 3, 1.)
182     cmap.set_under([0.75] * 3, 1.)
183     # fname
184     if fname is None:
185         fname = data.natural_name
186     # autosave
187     if len(chopped) > 10:
188         if not autosave:
189             print('more than 10 images will be generated: forcing autosave')
190             autosave = True
191     # output folder
192     if autosave:
193         if save_directory:
194             pass
195         else:
196             if len(chopped) == 1:
197                 save_directory = os.getcwd()
198             else:
199                 folder_name = 'quick2D ' + wt_kit.TimeStamp().path
200                 os.mkdir(folder_name)
201                 save_directory = folder_name
202     # loop through image generation
203     out = []
204     for i, d in enumerate(chopped.values()):
205         # unpack data -----------------------------------------------------------------------------
206         xaxis = d.axes[0]
207         xlim = xaxis.min(), xaxis.max()
208         yaxis = d.axes[1]
209         ylim = xaxis.min(), yaxis.max()
210         channel = d.channels[channel_index]
211         zi = channel[:]
212         zi = np.ma.masked_invalid(zi)
213         # create figure ---------------------------------------------------------------------------
214         if xaxis.units == yaxis.units:
215             xr = xlim[1] - xlim[0]
216             yr = ylim[1] - ylim[0]
217             aspect = np.abs(yr / xr)
218             if 3 < aspect or aspect < 1 / 3.:
219                 # TODO: raise warning here
220                 aspect = np.clip(aspect, 1 / 3., 3.)
221         else:
222             aspect = 1
223         fig, gs = create_figure(width='single', nrows=1, cols=[1, 'cbar'],
224                                 aspects=[[[0, 0], aspect]])
225         ax = plt.subplot(gs[0])
226         ax.patch.set_facecolor('w')
227         # levels ----------------------------------------------------------------------------------
228         if channel.signed:
229             if local:
230                 limit = channel.mag
231             else:
232                 data_channel = data.channels[channel_index]
233                 if dynamic_range:
234                     limit = min(abs(data_channel.null - data_channel.min()),
235                                 abs(data_channel.null - data_channel.max()))
236                 else:
237                     limit = data_channel.mag
238             if np.isnan(limit):
239                 limit = 1.
240             if limit is np.ma.masked:
241                 limit = 1.
242             levels = np.linspace(-limit + channel.null, limit + channel.null, 200)
243         else:
244             if local:
245                 levels = np.linspace(channel.null, np.nanmax(zi), 200)
246             else:
247                 data_channel = data.channels[channel_index]
248                 if data_channel.max() < data_channel.null:
249                     levels = np.linspace(data_channel.min(), data_channel.null, 200)
250                 else:
251                     levels = np.linspace(data_channel.null, data_channel.max(), 200)
252         # colors ----------------------------------------------------------------------------------
253         if pixelated:
254             ax.pcolor(d, cmap=cmap, vmin=levels.min(), vmax=levels.max())
255         else:
256             ax.contourf(d, cmap=cmap, levels=levels)
257         # contour lines ---------------------------------------------------------------------------
258         if contours:
259             raise NotImplementedError
260         # decoration ------------------------------------------------------------------------------
261         plt.xticks(rotation=45, fontsize=14)
262         plt.yticks(fontsize=14)
263         ax.set_xlabel(xaxis.label, fontsize=18)
264         ax.set_ylabel(yaxis.label, fontsize=18)
265         # colorbar
266         cax = plt.subplot(gs[1])
267         cbar_ticks = np.linspace(levels.min(), levels.max(), 11)
268         plot_colorbar(cax=cax, ticks=cbar_ticks, label=channel.name, cmap=cmap)
269         # save figure -----------------------------------------------------------------------------
270         if autosave:
271             if fname:
272                 file_name = fname + ' ' + str(i).zfill(3)
273             else:
274                 file_name = str(i).zfill(3)
275             fpath = os.path.join(save_directory, file_name + '.png')
276             savefig(fpath, fig=fig)
277             plt.close()
278             if verbose:
279                 print('image saved at', fpath)
280             out.append(fpath)
281     return out
282
```

Path: `examples/fringes_transform.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """
3 Fringes transform
4 =================
5 
6 An example of transform on a dataset containing fringes.
7 """
8 
9 import matplotlib.pyplot as plt
10 
11 import WrightTools as wt
12 from WrightTools import datasets
13 
14 p = datasets.PyCMDS.w2_w1_000
15 data = wt.data.from_PyCMDS(p)
16 
17 data.signal_mean.symmetric_root(0.5)  # to amplitude level
18 
19 fig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'])
20 
21 # as taken
22 ax = plt.subplot(gs[0, 0])
23 ax.pcolor(data)
24 wt.artists.set_ax_labels(xlabel=data.w2.label, ylabel=data.w1.label)
25 ax.grid()
26 ax.set_title('as taken', fontsize=20)
27 
28 # transformed
29 ax = plt.subplot(gs[0, 1])
30 data.transform(['wm', 'w1'])
31 data.convert('wn')
32 ax.pcolor(data)
33 wt.artists.set_ax_labels(xlabel=data.wm.label, yticks=False)
34 ax.grid()
35 ax.set_title('transformed', fontsize=20)
36 
37 # colorbar
38 cax = plt.subplot(gs[0, -1])
39 wt.artists.plot_colorbar(cax, label='amplitude')
40
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/WrightTools/artists/_quick.py b/WrightTools/artists/_quick.py
--- a/WrightTools/artists/_quick.py
+++ b/WrightTools/artists/_quick.py
@@ -123,7 +123,7 @@
     return out
 
 
-def quick2D(data, xaxis=1, yaxis=0, at={}, channel=0, *, contours=0, pixelated=True,
+def quick2D(data, xaxis=0, yaxis=1, at={}, channel=0, *, contours=0, pixelated=True,
             dynamic_range=False, local=False, contours_local=True, autosave=False,
             save_directory=None, fname=None, verbose=True):
     """Quickly plot 2D slice(s) of data.
@@ -133,9 +133,9 @@
     data : WrightTools.Data object.
         Data to plot.
     xaxis : string or integer (optional)
-        Expression or index of horizontal axis. Default is 1.
+        Expression or index of horizontal axis. Default is 0.
     yaxis : string or integer (optional)
-        Expression or index of vertical axis. Default is 0.
+        Expression or index of vertical axis. Default is 1.
     at : dictionary (optional)
         Dictionary of parameters in non-plotted dimension(s). If not
         provided, plots will be made at each coordinate.
diff --git a/examples/fringes_transform.py b/examples/fringes_transform.py
--- a/examples/fringes_transform.py
+++ b/examples/fringes_transform.py
@@ -15,6 +15,7 @@
 data = wt.data.from_PyCMDS(p)
 
 data.signal_mean.symmetric_root(0.5)  # to amplitude level
+data.convert('wn')
 
 fig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'])

{"golden_diff": "diff --git a/WrightTools/artists/_quick.py b/WrightTools/artists/_quick.py\n--- a/WrightTools/artists/_quick.py\n+++ b/WrightTools/artists/_quick.py\n@@ -123,7 +123,7 @@\n     return out\n \n \n-def quick2D(data, xaxis=1, yaxis=0, at={}, channel=0, *, contours=0, pixelated=True,\n+def quick2D(data, xaxis=0, yaxis=1, at={}, channel=0, *, contours=0, pixelated=True,\n             dynamic_range=False, local=False, contours_local=True, autosave=False,\n             save_directory=None, fname=None, verbose=True):\n     \"\"\"Quickly plot 2D slice(s) of data.\n@@ -133,9 +133,9 @@\n     data : WrightTools.Data object.\n         Data to plot.\n     xaxis : string or integer (optional)\n-        Expression or index of horizontal axis. Default is 1.\n+        Expression or index of horizontal axis. Default is 0.\n     yaxis : string or integer (optional)\n-        Expression or index of vertical axis. Default is 0.\n+        Expression or index of vertical axis. Default is 1.\n     at : dictionary (optional)\n         Dictionary of parameters in non-plotted dimension(s). If not\n         provided, plots will be made at each coordinate.\ndiff --git a/examples/fringes_transform.py b/examples/fringes_transform.py\n--- a/examples/fringes_transform.py\n+++ b/examples/fringes_transform.py\n@@ -15,6 +15,7 @@\n data = wt.data.from_PyCMDS(p)\n \n data.signal_mean.symmetric_root(0.5)  # to amplitude level\n+data.convert('wn')\n \n fig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'])\n", "issue": "quick2D returns transposed plot\n`artists.quick2D` uses the overloaded `ax.pcolor` and `ax.contourf` to plot arrays--- see [here](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists/_quick.py#L252). \r\n\r\nHowever, `ax.contourf` does not properly handle the arrays. I think the problem is [line255](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists/_base.py#L255). I think `zi` should instead be `zi.T` to handle the way matplotlib indexes arrays. \r\n \r\n\n", "before_files": [{"content": "\"\"\"Quick plotting.\"\"\"\n\n\n# --- import --------------------------------------------------------------------------------------\n\n\nimport os\n\nimport numpy as np\n\nimport matplotlib.pyplot as plt\n\nfrom ._helpers import create_figure, plot_colorbar, savefig\nfrom ._colors import colormaps\nfrom .. import kit as wt_kit\n\n\n# --- define --------------------------------------------------------------------------------------\n\n\n__all__ = ['quick1D', 'quick2D']\n\n\n# --- general purpose plotting functions ----------------------------------------------------------\n\n\ndef quick1D(data, axis=0, at={}, channel=0, *, local=False, autosave=False, save_directory=None,\n            fname=None, verbose=True):\n    \"\"\"Quickly plot 1D slice(s) of data.\n\n    Parameters\n    ----------\n    data : WrightTools.Data object\n        Data to plot.\n    axis : string or integer (optional)\n        Expression or index of axis. Default is 0.\n    at : dictionary (optional)\n        Dictionary of parameters in non-plotted dimension(s). If not\n        provided, plots will be made at each coordinate.\n    channel : string or integer (optional)\n        Name or index of channel to plot. Default is 0.\n    local : boolean (optional)\n        Toggle plotting locally. Default is False.\n    autosave : boolean (optional)\n         Toggle autosave. Default is False.\n    save_directory : string (optional)\n         Location to save image(s). Default is None (auto-generated).\n    fname : string (optional)\n         File name. If None, data name is used. Default is None.\n    verbose : boolean (optional)\n        Toggle talkback. Default is True.\n\n    Returns\n    -------\n    list of strings\n        List of saved image files (if any).\n    \"\"\"\n    # prepare data\n    chopped = data.chop(axis, at=at, verbose=False)\n    # channel index\n    channel_index = wt_kit.get_index(data.channel_names, channel)\n    # prepare figure\n    fig = None\n    if len(chopped) > 10:\n        if not autosave:\n            print('more than 10 images will be generated: forcing autosave')\n            autosave = True\n    # prepare output folders\n    if autosave:\n        if save_directory:\n            pass\n        else:\n            if len(chopped) == 1:\n                save_directory = os.getcwd()\n                if fname:\n                    pass\n                else:\n                    fname = data.natural_name\n            else:\n                folder_name = 'mpl_1D ' + wt_kit.TimeStamp().path\n                os.mkdir(folder_name)\n                save_directory = folder_name\n    # chew through image generation\n    out = []\n    for i, d in enumerate(chopped.values()):\n        # unpack data -----------------------------------------------------------------------------\n        axis = d.axes[0]\n        xi = axis.full\n        channel = d.channels[channel_index]\n        zi = channel[:]\n        # create figure ---------------------------------------------------------------------------\n        aspects = [[[0, 0], 0.5]]\n        fig, gs = create_figure(width='single', nrows=1, cols=[1], aspects=aspects)\n        ax = plt.subplot(gs[0, 0])\n        # plot ------------------------------------------------------------------------------------\n        plt.plot(xi, zi, lw=2)\n        plt.scatter(xi, zi, color='grey', alpha=0.5, edgecolor='none')\n        # decoration ------------------------------------------------------------------------------\n        plt.grid()\n        # limits\n        if local:\n            pass\n        else:\n            data_channel = data.channels[channel_index]\n            plt.ylim(data_channel.min(), data_channel.max())\n        # label axes\n        ax.set_xlabel(axis.label, fontsize=18)\n        ax.set_ylabel(channel.name, fontsize=18)\n        plt.xticks(rotation=45)\n        plt.xlim(xi.min(), xi.max())\n        # save ------------------------------------------------------------------------------------\n        if autosave:\n            if fname:\n                file_name = fname + ' ' + str(i).zfill(3)\n            else:\n                file_name = str(i).zfill(3)\n            fpath = os.path.join(save_directory, file_name + '.png')\n            savefig(fpath, fig=fig)\n            plt.close()\n            if verbose:\n                print('image saved at', fpath)\n            out.append(fpath)\n    return out\n\n\ndef quick2D(data, xaxis=1, yaxis=0, at={}, channel=0, *, contours=0, pixelated=True,\n            dynamic_range=False, local=False, contours_local=True, autosave=False,\n            save_directory=None, fname=None, verbose=True):\n    \"\"\"Quickly plot 2D slice(s) of data.\n\n    Parameters\n    ----------\n    data : WrightTools.Data object.\n        Data to plot.\n    xaxis : string or integer (optional)\n        Expression or index of horizontal axis. Default is 1.\n    yaxis : string or integer (optional)\n        Expression or index of vertical axis. Default is 0.\n    at : dictionary (optional)\n        Dictionary of parameters in non-plotted dimension(s). If not\n        provided, plots will be made at each coordinate.\n    channel : string or integer (optional)\n        Name or index of channel to plot. Default is 0.\n    contours : integer (optional)\n        The number of black contour lines to add to the plot. Default is 0.\n    pixelated : boolean (optional)\n        Toggle between pcolor and contourf (deulaney) plotting backends.\n        Default is True (pcolor).\n    dynamic_range : boolean (optional)\n        Force the colorbar to use all of its colors. Only changes behavior\n        for signed channels. Default is False.\n    local : boolean (optional)\n        Toggle plotting locally. Default is False.\n    contours_local : boolean (optional)\n        Toggle plotting black contour lines locally. Default is True.\n    autosave : boolean (optional)\n         Toggle autosave. Default is False.\n    save_directory : string (optional)\n         Location to save image(s). Default is None (auto-generated).\n    fname : string (optional)\n         File name. If None, data name is used. Default is None.\n    verbose : boolean (optional)\n        Toggle talkback. Default is True.\n\n    Returns\n    -------\n    list of strings\n        List of saved image files (if any).\n    \"\"\"\n    # prepare data\n    chopped = data.chop(xaxis, yaxis, at=at, verbose=False)\n    # channel index\n    channel_index = wt_kit.get_index(data.channel_names, channel)\n    # colormap\n    # get colormap\n    if data.channels[channel_index].signed:\n        cmap = 'signed'\n    else:\n        cmap = 'default'\n    cmap = colormaps[cmap]\n    cmap.set_bad([0.75] * 3, 1.)\n    cmap.set_under([0.75] * 3, 1.)\n    # fname\n    if fname is None:\n        fname = data.natural_name\n    # autosave\n    if len(chopped) > 10:\n        if not autosave:\n            print('more than 10 images will be generated: forcing autosave')\n            autosave = True\n    # output folder\n    if autosave:\n        if save_directory:\n            pass\n        else:\n            if len(chopped) == 1:\n                save_directory = os.getcwd()\n            else:\n                folder_name = 'quick2D ' + wt_kit.TimeStamp().path\n                os.mkdir(folder_name)\n                save_directory = folder_name\n    # loop through image generation\n    out = []\n    for i, d in enumerate(chopped.values()):\n        # unpack data -----------------------------------------------------------------------------\n        xaxis = d.axes[0]\n        xlim = xaxis.min(), xaxis.max()\n        yaxis = d.axes[1]\n        ylim = xaxis.min(), yaxis.max()\n        channel = d.channels[channel_index]\n        zi = channel[:]\n        zi = np.ma.masked_invalid(zi)\n        # create figure ---------------------------------------------------------------------------\n        if xaxis.units == yaxis.units:\n            xr = xlim[1] - xlim[0]\n            yr = ylim[1] - ylim[0]\n            aspect = np.abs(yr / xr)\n            if 3 < aspect or aspect < 1 / 3.:\n                # TODO: raise warning here\n                aspect = np.clip(aspect, 1 / 3., 3.)\n        else:\n            aspect = 1\n        fig, gs = create_figure(width='single', nrows=1, cols=[1, 'cbar'],\n                                aspects=[[[0, 0], aspect]])\n        ax = plt.subplot(gs[0])\n        ax.patch.set_facecolor('w')\n        # levels ----------------------------------------------------------------------------------\n        if channel.signed:\n            if local:\n                limit = channel.mag\n            else:\n                data_channel = data.channels[channel_index]\n                if dynamic_range:\n                    limit = min(abs(data_channel.null - data_channel.min()),\n                                abs(data_channel.null - data_channel.max()))\n                else:\n                    limit = data_channel.mag\n            if np.isnan(limit):\n                limit = 1.\n            if limit is np.ma.masked:\n                limit = 1.\n            levels = np.linspace(-limit + channel.null, limit + channel.null, 200)\n        else:\n            if local:\n                levels = np.linspace(channel.null, np.nanmax(zi), 200)\n            else:\n                data_channel = data.channels[channel_index]\n                if data_channel.max() < data_channel.null:\n                    levels = np.linspace(data_channel.min(), data_channel.null, 200)\n                else:\n                    levels = np.linspace(data_channel.null, data_channel.max(), 200)\n        # colors ----------------------------------------------------------------------------------\n        if pixelated:\n            ax.pcolor(d, cmap=cmap, vmin=levels.min(), vmax=levels.max())\n        else:\n            ax.contourf(d, cmap=cmap, levels=levels)\n        # contour lines ---------------------------------------------------------------------------\n        if contours:\n            raise NotImplementedError\n        # decoration ------------------------------------------------------------------------------\n        plt.xticks(rotation=45, fontsize=14)\n        plt.yticks(fontsize=14)\n        ax.set_xlabel(xaxis.label, fontsize=18)\n        ax.set_ylabel(yaxis.label, fontsize=18)\n        # colorbar\n        cax = plt.subplot(gs[1])\n        cbar_ticks = np.linspace(levels.min(), levels.max(), 11)\n        plot_colorbar(cax=cax, ticks=cbar_ticks, label=channel.name, cmap=cmap)\n        # save figure -----------------------------------------------------------------------------\n        if autosave:\n            if fname:\n                file_name = fname + ' ' + str(i).zfill(3)\n            else:\n                file_name = str(i).zfill(3)\n            fpath = os.path.join(save_directory, file_name + '.png')\n            savefig(fpath, fig=fig)\n            plt.close()\n            if verbose:\n                print('image saved at', fpath)\n            out.append(fpath)\n    return out\n", "path": "WrightTools/artists/_quick.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"\nFringes transform\n=================\n\nAn example of transform on a dataset containing fringes.\n\"\"\"\n\nimport matplotlib.pyplot as plt\n\nimport WrightTools as wt\nfrom WrightTools import datasets\n\np = datasets.PyCMDS.w2_w1_000\ndata = wt.data.from_PyCMDS(p)\n\ndata.signal_mean.symmetric_root(0.5)  # to amplitude level\n\nfig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'])\n\n# as taken\nax = plt.subplot(gs[0, 0])\nax.pcolor(data)\nwt.artists.set_ax_labels(xlabel=data.w2.label, ylabel=data.w1.label)\nax.grid()\nax.set_title('as taken', fontsize=20)\n\n# transformed\nax = plt.subplot(gs[0, 1])\ndata.transform(['wm', 'w1'])\ndata.convert('wn')\nax.pcolor(data)\nwt.artists.set_ax_labels(xlabel=data.wm.label, yticks=False)\nax.grid()\nax.set_title('transformed', fontsize=20)\n\n# colorbar\ncax = plt.subplot(gs[0, -1])\nwt.artists.plot_colorbar(cax, label='amplitude')\n", "path": "examples/fringes_transform.py"}], "after_files": [{"content": "\"\"\"Quick plotting.\"\"\"\n\n\n# --- import --------------------------------------------------------------------------------------\n\n\nimport os\n\nimport numpy as np\n\nimport matplotlib.pyplot as plt\n\nfrom ._helpers import create_figure, plot_colorbar, savefig\nfrom ._colors import colormaps\nfrom .. import kit as wt_kit\n\n\n# --- define --------------------------------------------------------------------------------------\n\n\n__all__ = ['quick1D', 'quick2D']\n\n\n# --- general purpose plotting functions ----------------------------------------------------------\n\n\ndef quick1D(data, axis=0, at={}, channel=0, *, local=False, autosave=False, save_directory=None,\n            fname=None, verbose=True):\n    \"\"\"Quickly plot 1D slice(s) of data.\n\n    Parameters\n    ----------\n    data : WrightTools.Data object\n        Data to plot.\n    axis : string or integer (optional)\n        Expression or index of axis. Default is 0.\n    at : dictionary (optional)\n        Dictionary of parameters in non-plotted dimension(s). If not\n        provided, plots will be made at each coordinate.\n    channel : string or integer (optional)\n        Name or index of channel to plot. Default is 0.\n    local : boolean (optional)\n        Toggle plotting locally. Default is False.\n    autosave : boolean (optional)\n         Toggle autosave. Default is False.\n    save_directory : string (optional)\n         Location to save image(s). Default is None (auto-generated).\n    fname : string (optional)\n         File name. If None, data name is used. Default is None.\n    verbose : boolean (optional)\n        Toggle talkback. Default is True.\n\n    Returns\n    -------\n    list of strings\n        List of saved image files (if any).\n    \"\"\"\n    # prepare data\n    chopped = data.chop(axis, at=at, verbose=False)\n    # channel index\n    channel_index = wt_kit.get_index(data.channel_names, channel)\n    # prepare figure\n    fig = None\n    if len(chopped) > 10:\n        if not autosave:\n            print('more than 10 images will be generated: forcing autosave')\n            autosave = True\n    # prepare output folders\n    if autosave:\n        if save_directory:\n            pass\n        else:\n            if len(chopped) == 1:\n                save_directory = os.getcwd()\n                if fname:\n                    pass\n                else:\n                    fname = data.natural_name\n            else:\n                folder_name = 'mpl_1D ' + wt_kit.TimeStamp().path\n                os.mkdir(folder_name)\n                save_directory = folder_name\n    # chew through image generation\n    out = []\n    for i, d in enumerate(chopped.values()):\n        # unpack data -----------------------------------------------------------------------------\n        axis = d.axes[0]\n        xi = axis.full\n        channel = d.channels[channel_index]\n        zi = channel[:]\n        # create figure ---------------------------------------------------------------------------\n        aspects = [[[0, 0], 0.5]]\n        fig, gs = create_figure(width='single', nrows=1, cols=[1], aspects=aspects)\n        ax = plt.subplot(gs[0, 0])\n        # plot ------------------------------------------------------------------------------------\n        plt.plot(xi, zi, lw=2)\n        plt.scatter(xi, zi, color='grey', alpha=0.5, edgecolor='none')\n        # decoration ------------------------------------------------------------------------------\n        plt.grid()\n        # limits\n        if local:\n            pass\n        else:\n            data_channel = data.channels[channel_index]\n            plt.ylim(data_channel.min(), data_channel.max())\n        # label axes\n        ax.set_xlabel(axis.label, fontsize=18)\n        ax.set_ylabel(channel.name, fontsize=18)\n        plt.xticks(rotation=45)\n        plt.xlim(xi.min(), xi.max())\n        # save ------------------------------------------------------------------------------------\n        if autosave:\n            if fname:\n                file_name = fname + ' ' + str(i).zfill(3)\n            else:\n                file_name = str(i).zfill(3)\n            fpath = os.path.join(save_directory, file_name + '.png')\n            savefig(fpath, fig=fig)\n            plt.close()\n            if verbose:\n                print('image saved at', fpath)\n            out.append(fpath)\n    return out\n\n\ndef quick2D(data, xaxis=0, yaxis=1, at={}, channel=0, *, contours=0, pixelated=True,\n            dynamic_range=False, local=False, contours_local=True, autosave=False,\n            save_directory=None, fname=None, verbose=True):\n    \"\"\"Quickly plot 2D slice(s) of data.\n\n    Parameters\n    ----------\n    data : WrightTools.Data object.\n        Data to plot.\n    xaxis : string or integer (optional)\n        Expression or index of horizontal axis. Default is 0.\n    yaxis : string or integer (optional)\n        Expression or index of vertical axis. Default is 1.\n    at : dictionary (optional)\n        Dictionary of parameters in non-plotted dimension(s). If not\n        provided, plots will be made at each coordinate.\n    channel : string or integer (optional)\n        Name or index of channel to plot. Default is 0.\n    contours : integer (optional)\n        The number of black contour lines to add to the plot. Default is 0.\n    pixelated : boolean (optional)\n        Toggle between pcolor and contourf (deulaney) plotting backends.\n        Default is True (pcolor).\n    dynamic_range : boolean (optional)\n        Force the colorbar to use all of its colors. Only changes behavior\n        for signed channels. Default is False.\n    local : boolean (optional)\n        Toggle plotting locally. Default is False.\n    contours_local : boolean (optional)\n        Toggle plotting black contour lines locally. Default is True.\n    autosave : boolean (optional)\n         Toggle autosave. Default is False.\n    save_directory : string (optional)\n         Location to save image(s). Default is None (auto-generated).\n    fname : string (optional)\n         File name. If None, data name is used. Default is None.\n    verbose : boolean (optional)\n        Toggle talkback. Default is True.\n\n    Returns\n    -------\n    list of strings\n        List of saved image files (if any).\n    \"\"\"\n    # prepare data\n    chopped = data.chop(xaxis, yaxis, at=at, verbose=False)\n    # channel index\n    channel_index = wt_kit.get_index(data.channel_names, channel)\n    # colormap\n    # get colormap\n    if data.channels[channel_index].signed:\n        cmap = 'signed'\n    else:\n        cmap = 'default'\n    cmap = colormaps[cmap]\n    cmap.set_bad([0.75] * 3, 1.)\n    cmap.set_under([0.75] * 3, 1.)\n    # fname\n    if fname is None:\n        fname = data.natural_name\n    # autosave\n    if len(chopped) > 10:\n        if not autosave:\n            print('more than 10 images will be generated: forcing autosave')\n            autosave = True\n    # output folder\n    if autosave:\n        if save_directory:\n            pass\n        else:\n            if len(chopped) == 1:\n                save_directory = os.getcwd()\n            else:\n                folder_name = 'quick2D ' + wt_kit.TimeStamp().path\n                os.mkdir(folder_name)\n                save_directory = folder_name\n    # loop through image generation\n    out = []\n    for i, d in enumerate(chopped.values()):\n        # unpack data -----------------------------------------------------------------------------\n        xaxis = d.axes[0]\n        xlim = xaxis.min(), xaxis.max()\n        yaxis = d.axes[1]\n        ylim = xaxis.min(), yaxis.max()\n        channel = d.channels[channel_index]\n        zi = channel[:]\n        zi = np.ma.masked_invalid(zi)\n        # create figure ---------------------------------------------------------------------------\n        if xaxis.units == yaxis.units:\n            xr = xlim[1] - xlim[0]\n            yr = ylim[1] - ylim[0]\n            aspect = np.abs(yr / xr)\n            if 3 < aspect or aspect < 1 / 3.:\n                # TODO: raise warning here\n                aspect = np.clip(aspect, 1 / 3., 3.)\n        else:\n            aspect = 1\n        fig, gs = create_figure(width='single', nrows=1, cols=[1, 'cbar'],\n                                aspects=[[[0, 0], aspect]])\n        ax = plt.subplot(gs[0])\n        ax.patch.set_facecolor('w')\n        # levels ----------------------------------------------------------------------------------\n        if channel.signed:\n            if local:\n                limit = channel.mag\n            else:\n                data_channel = data.channels[channel_index]\n                if dynamic_range:\n                    limit = min(abs(data_channel.null - data_channel.min()),\n                                abs(data_channel.null - data_channel.max()))\n                else:\n                    limit = data_channel.mag\n            if np.isnan(limit):\n                limit = 1.\n            if limit is np.ma.masked:\n                limit = 1.\n            levels = np.linspace(-limit + channel.null, limit + channel.null, 200)\n        else:\n            if local:\n                levels = np.linspace(channel.null, np.nanmax(zi), 200)\n            else:\n                data_channel = data.channels[channel_index]\n                if data_channel.max() < data_channel.null:\n                    levels = np.linspace(data_channel.min(), data_channel.null, 200)\n                else:\n                    levels = np.linspace(data_channel.null, data_channel.max(), 200)\n        # colors ----------------------------------------------------------------------------------\n        if pixelated:\n            ax.pcolor(d, cmap=cmap, vmin=levels.min(), vmax=levels.max())\n        else:\n            ax.contourf(d, cmap=cmap, levels=levels)\n        # contour lines ---------------------------------------------------------------------------\n        if contours:\n            raise NotImplementedError\n        # decoration ------------------------------------------------------------------------------\n        plt.xticks(rotation=45, fontsize=14)\n        plt.yticks(fontsize=14)\n        ax.set_xlabel(xaxis.label, fontsize=18)\n        ax.set_ylabel(yaxis.label, fontsize=18)\n        # colorbar\n        cax = plt.subplot(gs[1])\n        cbar_ticks = np.linspace(levels.min(), levels.max(), 11)\n        plot_colorbar(cax=cax, ticks=cbar_ticks, label=channel.name, cmap=cmap)\n        # save figure -----------------------------------------------------------------------------\n        if autosave:\n            if fname:\n                file_name = fname + ' ' + str(i).zfill(3)\n            else:\n                file_name = str(i).zfill(3)\n            fpath = os.path.join(save_directory, file_name + '.png')\n            savefig(fpath, fig=fig)\n            plt.close()\n            if verbose:\n                print('image saved at', fpath)\n            out.append(fpath)\n    return out\n", "path": "WrightTools/artists/_quick.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"\nFringes transform\n=================\n\nAn example of transform on a dataset containing fringes.\n\"\"\"\n\nimport matplotlib.pyplot as plt\n\nimport WrightTools as wt\nfrom WrightTools import datasets\n\np = datasets.PyCMDS.w2_w1_000\ndata = wt.data.from_PyCMDS(p)\n\ndata.signal_mean.symmetric_root(0.5)  # to amplitude level\ndata.convert('wn')\n\nfig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'])\n\n# as taken\nax = plt.subplot(gs[0, 0])\nax.pcolor(data)\nwt.artists.set_ax_labels(xlabel=data.w2.label, ylabel=data.w1.label)\nax.grid()\nax.set_title('as taken', fontsize=20)\n\n# transformed\nax = plt.subplot(gs[0, 1])\ndata.transform(['wm', 'w1'])\ndata.convert('wn')\nax.pcolor(data)\nwt.artists.set_ax_labels(xlabel=data.wm.label, yticks=False)\nax.grid()\nax.set_title('transformed', fontsize=20)\n\n# colorbar\ncax = plt.subplot(gs[0, -1])\nwt.artists.plot_colorbar(cax, label='amplitude')\n", "path": "examples/fringes_transform.py"}]}