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