.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_changing_axes_and_fig.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_changing_axes_and_fig.py: Changing axes and figure visualization ================================================== How to modify a plot using fig and ax. .. GENERATED FROM PYTHON SOURCE LINES 8-32 .. image-sg:: /auto_examples/images/sphx_glr_plot_changing_axes_and_fig_001.png :alt: T-S Diagram with Depth :srcset: /auto_examples/images/sphx_glr_plot_changing_axes_and_fig_001.png :class: sphx-glr-single-img .. code-block:: Python from gerg_plotting import ScatterPlot, data_from_csv # Let's read in the example data data = data_from_csv('example_data/sample_glider_data.csv') # Initialize the scatter plot scatter = ScatterPlot(data) # Plot the TS diagram with a color variable scatter.TS(color_var='depth',contours=False) # ScatterPlot.ax is a matplotlib.axes.Axes object # zoom out a bit scatter.ax.set_ylim((3,33.5)) scatter.ax.set_xlim(31.5,37.5) # Make the colors pop scatter.ax.set_facecolor('gray') # ScatterPlot.fig is a matplotlib.figure.Figure object # Let's change the title from "T-S Diagram" to something more descriptive scatter.ax.set_title('T-S Diagram with Depth',fontdict={'fontsize':14,'fontweight':'bold'}) scatter.save('example_plots/modifying_plot.png',bbox_inches='tight') scatter.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.119 seconds) .. _sphx_glr_download_auto_examples_plot_changing_axes_and_fig.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_changing_axes_and_fig.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_changing_axes_and_fig.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_changing_axes_and_fig.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_