Post · 2 min read· pp. 978–979

aerosandbox.tools.pretty_plots.plots.contour

Attributes

Functions

contour(*args[, levels, colorbar, linelabels, cmap, ...])An analogue for plt.contour and plt.tricontour and friends that produces a much prettier default graph.

Module Contents

aerosandbox.tools.pretty_plots.plots.contour.contour(*args, levels=31, colorbar=True, linelabels=True, cmap=None, alpha=0.7, extend='neither', linecolor='k', linewidths=0.5, extendrect=True, linelabels_format=eng_string, linelabels_fontsize=8, max_side_length_nondim=np.inf, colorbar_label=None, x_log_scale=False, y_log_scale=False, z_log_scale=False, mask=None, drop_nans=None, contour_kwargs=None, contourf_kwargs=None, colorbar_kwargs=None, linelabels_kwargs=None, **kwargs) : An analogue for plt.contour and plt.tricontour and friends that produces a much prettier default graph.

code
Can take inputs with either contour or tricontour syntax.

See syntax here:
:   <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contour.html>
    <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.contourf.html>
    <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.tricontour.html>
    <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.tricontourf.html>

Parameters:
:   - **X** – If dataset is gridded, follow contour syntax. Otherwise, follow tricontour syntax.
    - **Y** – If dataset is gridded, follow contour syntax. Otherwise, follow tricontour syntax.
    - **Z** – If dataset is gridded, follow contour syntax. Otherwise, follow tricontour syntax.
    - **levels** (*Union**[**int**,* *List**,* *numpy.ndarray**]*) – See contour docs.
    - **colorbar** (*bool*) – Should we draw a colorbar?
    - **linelabels** (*bool*) – Should we add line labels?
    - **cmap** – What colormap should we use?
    - **alpha** (*float*) – What transparency should all plot elements be?
    - **extend** (*str*) – See contour docs.
    - **linecolor** – What color should the line labels be?
    - **linewidths** (*float*) – See contour docs.
    - **extendrect** (*bool*) – See colorbar docs.
    - **linelabels\_format** (*Union**[**str**,* *Callable**[**[**float**]**,* *str**]**]*) – See ax.clabel docs.
    - **linelabels\_fontsize** (*float*) – See ax.clabel docs.
    - **contour\_kwargs** (*Dict*) – Additional keyword arguments for contour.
    - **contourf\_kwargs** (*Dict*) – Additional keyword arguments for contourf.
    - **colorbar\_kwargs** (*Dict*) – Additional keyword arguments for colorbar.
    - **linelabels\_kwargs** (*Dict*) – Additional keyword arguments for the line labels (ax.clabel).
    - **\*\*kwargs** – Additional keywords, which are passed to both contour and contourf.
    - **max\_side\_length\_nondim** (*float*) –
    - **colorbar\_label** (*str*) –
    - **x\_log\_scale** (*bool*) –
    - **y\_log\_scale** (*bool*) –
    - **z\_log\_scale** (*bool*) –
    - **mask** (*numpy.ndarray*) –
    - **drop\_nans** (*bool*) –

Returns: A tuple of (contour, contourf, colorbar) objects.

aerosandbox.tools.pretty_plots.plots.contour.x