-
Notifications
You must be signed in to change notification settings - Fork 175
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
allows empty rasters #601
allows empty rasters #601
Conversation
LGTM |
@@ -89,7 +89,8 @@ def rasterplot(time, spikes, ax=None, **kwargs): | |||
ax.set_ylim(len(spikes) - 0.5, -0.5) | |||
if len(spikes) == 1: | |||
ax.set_ylim(0.4, 1.6) # eventplot plots different for len==1 | |||
ax.set_xlim(left=0, right=max(time)) | |||
if time.any(): | |||
ax.set_xlim(left=0, right=max(time)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that this function assumes that time
begins at zero.
52b990b
to
485e4a2
Compare
I've pushed an additional commit that cleans up |
LGTM, again. 🌴 |
This looks great! I'm curious if we shouldn't bother with Alternatively, we could use |
The difficulty with But I didn't realize that the difference in file sizes was so large, and taking out eventplot would make the code easier. Another option is to turn eventplot off by default, but still have it there if people really want it. |
I like the idea of plot by default, and eventplot still available if desired. I'll try implementing a heuristic marker size based on the figure size and the number of neurons at the point when |
485e4a2
to
8b98284
Compare
I added a heuristic for the marker size that seems to work pretty well. |
Great! Let me test it out a bit then I'll merge. |
Added some commits; take a look @hunse and if it looks good I'll merge. |
LGTM, but this is getting tripped up on the Mock plot objects used to skip plotting in the examples. |
Oh right! Forgot about that. Will fix tomorrow. |
I was trying to think if there's a decent comment you could put there to explain it, but I can't think of anything. I think that hack will be fine for the time being. It would be nicer if we could somehow completely skip things like |
This is useful for generating animations.
- Made the rasters with and without `eventplot` look more similar. - Gave users the option to choose whether `eventplot` is used. This is useful if you want to enforce consistency across machines, for example by forcing `rasterplot` to not use `eventplot` so that the plot looks the same no matter the Matplotlib version. - Added an optional test/benchmark for `rasterplot` that just makes plots both with and without `eventplot` for easy assessment.
The default markersize is based on the size of the axes divided by the number of neurons. This heuristic works well as long as the user does not resize the plot (there's really nothing we can do in that case except use `plt.eventplot`, which has performance issues). We default to using `plt.plot` and the heuristic, but users can still specify to use `plt.eventplot` if they want. Using plot closely matches eventplot for all values of `n_neurons`, so this is used by default now for performance reasons (PDFs generated by `eventplot` can get very large). Other changes: - Implemented a simple `Plotter.Mock.__mul__` method to avoid an error in `test_izhikevich` when `NENGO_TEST_PLOT != 1`
c9ae1ef
to
9e8c1bb
Compare
For this PR and #627, which didn't have a changelog entry added.
9e8c1bb
to
db48599
Compare
this is useful for generating animations