Skip to content

Make _plot_image public #5952

Open
Open

Description

@jona-sassenhagen

evoked and tfr image plots have some fairly elaborate code to plot images with mask and contour. We could expose the (shared) underlying code publicly, greatly simplifying plotting of e.g. statistically thresholded GAT matrices.

Activity

  1. larsoner commented on Feb 18, 2019

    @larsoner
    Member

    Okay with me

  2. agramfort commented on Feb 18, 2019

    @agramfort
    SponsorMember

    what would be the signature of the public funciton?

  3. jona-sassenhagen commented on Feb 19, 2019

    @jona-sassenhagen
    ContributorAuthor

    The private function is here:

    https://github.com/mne-tools/mne-python/blob/master/mne/viz/utils.py#L2556

    Current call signature:

    def _plot_masked_image(ax, data, times, mask=None, picks=None, yvals=None,
                           cmap="RdBu_r", vmin=None, vmax=None, ylim=None,
                           mask_style="both", mask_alpha=.25, mask_cmap="Greys",
                           yscale="linear"):
    

    Probably ax should become a default kwarg ... data is mandatory ... I'd switch times and yvals for xvals and yvals and make both default to None ... maybe add a title, x/ylabel, cbar. So:

    def plot_masked_image(data, ax=None, xvals=None, yvals=None, mask=None, picks=None, 
                           cmap="RdBu_r", vmin=None, vmax=None, ylim=None,
                           mask_style="both", mask_alpha=.25, mask_cmap="Greys",
                           yscale="linear", title=None, xlabel=None, ylabel=None, cbar=False):
    

    @cbrnr @mmagnuski

  4. mmagnuski commented on Feb 19, 2019

    @mmagnuski
    Member

    I'm okay with that. Would it be better to call it plot_image, not plot_masked_image as the mask is optional? Or maybe plot_image_with_optional_mask_if_you_want_it ;)

  5. agramfort commented on Feb 19, 2019

    @agramfort
    SponsorMember
  6. jona-sassenhagen commented on Feb 28, 2019

    @jona-sassenhagen
    ContributorAuthor

    I will! Thanks guys.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions