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

Add more options to plot_spikes_hist for HNN-style histograms #186

Closed
blakecaldwell opened this issue Sep 19, 2020 · 4 comments · Fixed by #732
Closed

Add more options to plot_spikes_hist for HNN-style histograms #186

blakecaldwell opened this issue Sep 19, 2020 · 4 comments · Fixed by #732
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@blakecaldwell
Copy link
Member

Towards the goal of using hnn-core plots in HNN GUI, plot_spikes_hist() would be a good first example. If a suitable function was availble in hnn-core, it would make spikefn.py one step closer to being deprecated (jonescompneurolab/hnn#237)

The HNN spikefn.plot_hist() has some more parameters that aren't found in viz.plot_spikes_hist() in hnn-core:
https://github.com/jonescompneurolab/hnn/blob/master/spikefn.py#L235-L247

Basically, HNN needs an enhanced plot_spikes_hist() with tstop (xlim), color specification, histtype, linewidth. This could be a separate function for plotting 'bar' histogram types.

hnn-core/hnn_core/viz.py

Lines 51 to 73 in c879ce5

def plot_spikes_hist(spikes, ax=None, spike_types=None, show=True):
"""Plot the histogram of spiking activity across trials.
Parameters
----------
spikes : instance of Spikes
The spikes object from net.spikes
ax : instance of matplotlib axis | None
An axis object from matplotlib. If None,
a new figure is created.
spike_types: string | list | dictionary | None
String input of a valid spike type is plotted individually.
Ex: 'common', 'evdist', 'evprox', 'extgauss', 'extpois'
List of valid string inputs will plot each spike type individually.
Ex: ['common', 'evdist']
Dictionary of valid lists will plot list elements as a group.
Ex: {'Evoked': ['evdist', 'evprox'], 'External': ['extpois']}
If None, all input spike types are plotted individually if any
are present. Otherwise spikes from all cells are plotted.
Valid strings also include leading characters of spike types
Example: 'ext' is equivalent to ['extgauss', 'extpois']
show : bool
If True, show the figure.

Example calls are in https://github.com/jonescompneurolab/hnn/blob/master/simdat.py#L340-L353

@blakecaldwell blakecaldwell added enhancement New feature or request good first issue Good for newcomers labels Sep 19, 2020
@jasmainak
Copy link
Collaborator

I would argue against adding any matplotlib parameters, because users have access to the figure handle. Otherwise, we risk polluting the function signature.

But we can make the defaults match what is there in the GUI, I think that's reasonable.

@blakecaldwell
Copy link
Member Author

I think we should add parameters for bins and color because they cannot easily be changed with the figure handle of a histogram.

@jasmainak
Copy link
Collaborator

we could expose **kwargs that gets passed to ax.hist. So any customization the user wants can be done via that.

@aritrasinha108
Copy link

@jasmainak is this issue still open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants