Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superimpose two views? #43

Closed
jorge-ramirez-upm opened this issue Dec 10, 2017 · 2 comments
Closed

Superimpose two views? #43

jorge-ramirez-upm opened this issue Dec 10, 2017 · 2 comments

Comments

@jorge-ramirez-upm
Copy link
Owner

Views that share the x-axis could be plotted using an alternative right y-axis.
Is this possible?

@jorge-ramirez-upm
Copy link
Owner Author

In matplotlib, this is possible using the command twinx, see the code below. I don´t know how easy it is to integrate this code in Reptate.

import numpy as np
import matplotlib.pyplot as plt

fig, ax1 = plt.subplots()
t = np.arange(0.01, 10.0, 0.01)
s1 = np.exp(t)
ax1.plot(t, s1, 'b-')
ax1.set_xlabel('time (s)')

Make the y-axis label, ticks and tick labels match the line color.

ax1.set_ylabel('exp', color='b')
ax1.tick_params('y', colors='b')

ax2 = ax1.twinx()
s2 = np.sin(2 * np.pi * t)
ax2.plot(t, s2, 'r.')
ax2.set_ylabel('sin', color='r')
ax2.tick_params('y', colors='r')

fig.tight_layout()
plt.show()

@jorge-ramirez-upm
Copy link
Owner Author

I think this would complicate the code a lot without adding any necessary functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant