MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / DifferentScales

Function DifferentScales

DemoPrograms/Demo_Matplotlib_Browser_Paned.py:621–647  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

619
620
621def DifferentScales():
622 import numpy as np
623 import matplotlib.pyplot as plt
624
625 # Create some mock data
626 t = np.arange(0.01, 10.0, 0.01)
627 data1 = np.exp(t)
628 data2 = np.sin(2 * np.pi * t)
629
630 fig, ax1 = plt.subplots()
631
632 color = 'tab:red'
633 ax1.set_xlabel('time (s)')
634 ax1.set_ylabel('exp', color=color)
635 ax1.plot(t, data1, color=color)
636 ax1.tick_params(axis='y', labelcolor=color)
637
638 ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
639
640 color = 'tab:blue'
641 # we already handled the x-label with ax1
642 ax2.set_ylabel('sin', color=color)
643 ax2.plot(t, data2, color=color)
644 ax2.tick_params(axis='y', labelcolor=color)
645
646 fig.tight_layout() # otherwise the right y-label is slightly clipped
647 return fig
648
649
650def ExploringNormalizations():

Callers

nothing calls this directly

Calls 1

plotMethod · 0.45

Tested by

no test coverage detected