-
Notifications
You must be signed in to change notification settings - Fork 17
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
Argument for time units in visualizations #106
Comments
+1 for getting this done somehow at least . I always forget to do this properly and it would be nice to automate it. I was thinking maybe a super function that takes the plotting function and a dt values and returns the plotted function?
Or we add it to every function separately ?
…Sent from my iPhone
On Aug 31, 2017, at 3:42 PM, Christopher Ing ***@***.***> wrote:
There's a few mentions about keeping track of the "frame -> time" conversions in the msmbuilder code, but I didn't see any issue about it there or here. Seems like MSME is a decent place to do this conversion for visualization purposes, maybe through some optional argument?
At the very least, it's probably worth mentioning somewhere in MSME that the time units are not actually "nanoseconds" in the plot_timescales and plot_implied timescales examples, right? If FsPeptide stride was 20, then it would be correct, but I don't think that's the case?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The way I've done this before is using FuncFormatter You can just use the normal plotting functions and change them using a function that you define: from matplotlib.ticker import FuncFormatter
import numpy as np
from msmexplorer import plot_trace
ts = .1
def to_ns(x, pos):
return '{}'.format(x * ts)
a = np.random.random_sample(size=(500, 1))
ax, _ = plot_trace(a)
plt.show() ax, _ = plot_trace(a)
formatter = FuncFormatter(to_ns)
ax.xaxis.set_major_formatter(formatter)
plt.show() |
Wow, I was not aware this functionality existed. Are there any plots where this will not work? An interesting special case might be https://github.com/msmexplorer/msmexplorer/issues/105 , where the time colorbar is smoke and mirrors anyway? Anyway, adding a |
A minor improvement that I found out is that you can specify a third arg for the from matplotlib.ticker import FuncFormatter
import numpy as np
from msmexplorer import plot_trace
from matplotlib import pyplot as plt
from functools import partial
def to_ns(x, pos, ts):
return '{}'.format(x * ts)
a = np.random.random_sample(size=(500, 1))
ax, _ = plot_trace(a)
formatter = FuncFormatter(partial(to_ns, ts=0.1))
ax.xaxis.set_major_formatter(formatter)
plt.show() |
There's a few mentions about keeping track of the "frame -> time" conversions in the msmbuilder code, but I didn't see any issue about it there or here. Seems like MSME is a decent place to do this conversion for visualization purposes, maybe through some optional argument?
The text was updated successfully, but these errors were encountered: