.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/line_plots/inverted_log_scale.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_examples_line_plots_inverted_log_scale.py: Invert log scale ---------------- This example shows how to create an inverted y-axis that also uses a log scale. This is useful if you are looking at a column of data throughout the atmosphere and the y-axis is pressure. .. GENERATED FROM PYTHON SOURCE LINES 11-52 .. image-sg:: /examples/line_plots/images/sphx_glr_inverted_log_scale_001.png :alt: Test Line Plot, Inverted Log Scale :srcset: /examples/line_plots/images/sphx_glr_inverted_log_scale_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/.local/lib/python3.12/site-packages/emcpy/plots/create_plots.py:856: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator. ax.set_yticklabels(yticklabels['labels'], | .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from emcpy.plots.plots import LinePlot from emcpy.plots.create_plots import CreatePlot, CreateFigure def main(): x = [0, 401, 1039, 2774, 2408, 512] y = [0, 45, 225, 510, 1200, 1820] # Create line plot object lp = LinePlot(x, y) # Create plot object and add features plot1 = CreatePlot() plot1.plot_layers = [lp] plot1.add_title(label='Test Line Plot, Inverted Log Scale') plot1.add_xlabel(xlabel='X Axis Label') plot1.add_ylabel(ylabel='Y Axis Label') # Set y-scale to log and invert plot1.set_yscale('log') plot1.invert_yaxis() # Set new y labels ylabels = [0, 50, 100, 500, 1000, 2000] plot1.set_yticklabels(labels=ylabels) # Create figure fig = CreateFigure() fig.plot_list = [plot1] fig.create_figure() plt.show() if __name__ == '__main__': main() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.104 seconds) .. _sphx_glr_download_examples_line_plots_inverted_log_scale.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: inverted_log_scale.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: inverted_log_scale.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_