[3/3] Fastgraph: Plot Fastgraphs#916
Open
chinmaychinara91 wants to merge 7 commits into
Open
Conversation
- Adds `subtightplot.m`, A wrapper function for `subplot`. Adds the ability to define the gap between neighbouring subplots. - `subplot` prior to R2019b lacked this functionality, and the gap between subplots can reach 40% of figure area, which is pretty lavish. - In 2019b, MATLAB introduced `tiledLayout` and `nexttile` that can achieve the same but for backward compatibility it would be good to just stick to this external module.
Required for plotting Fastgraph as it uses the anatomical labels based on the atlas chosen by the user
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the 3rd and final part required for Fastgraph. It implements Fastgraph plotting, where each Fastgraph is a stacked area plot showing the distribution of stimulation-evoked responses across anatomical brain regions.
As the name suggests, Fastgraph stands for Functional-Anatomical STacked area graph. Each plot represents how stimulation of one site affects activity across other regions of the brain.
Prerequisite: Follow steps in PR #912
The GUI
Inputs
Regionuses the region colors for the plot, andLabeluses the above selected atlas label colors.RMSorMax Abs).20mmis considered close as the contacts close to the stim site will always give very high response so it needs to be ignored.Steps to use
Follow steps as in PR [2/3] Fastgraph: Remove SPES artifacts using EMD #912
Drag the artifact removed blocks (

_emd) toProcess1tab >Run > Import > Import recordings > Import MEG/EEG: Events. Set event name asODD, EVENand epoch time-100to900ms. For this sample data, we will be importing all theODDandEVENevents with a 1s epoch. The reason we chose this is due to the range of latencies (early, middle, late) mentioned above. Also note that appending the per session (represented by#1,#2) stim site info to theODDandEVENevents of the stimulation block earlier now helps in creating separate groups, else all would have clustered under one.Drag the

ODDandEVENgroups toProcess1tab and average them by trial to get as under.Ideally do it for all the entire stimulation blocks, but above just shows a sample of the data where

A11-A12shows low response andB3-B4andB'3-B'4show high response. To see the results, just drag the averaged trials toProcess1tab >Run > Stimulation > Plot Fastgraphsand set the values as shown in the process GUI image above to the plot as under.RMS).Avg: EVEN B'3-B'4 #1Fastgraph, theparahippocampal Lgave the highest response.LandRindicating above the x-axis represent the left hemisphere responses and below it represents the right hemisphere responses.ODDandEVENaverages per session per stimulation site. E.g. averagingAvg: EVEN A11-A12 4 #1 (15 files)andAvg: ODD A11-A12 4 #1 (15 files)to getAvg: A11-A12 4 #1. Just drag the two averaged events toProcess1tab >Run > Average > Average files > Everythingand rename it toAvg: A11-A12 4 #1.The Fastgraph for these final averaged files is as under:

Some more examples
Color by
Regionand only showFrontalandTemporalregionsColor by
Labeland show all regionsColor by
Labeland only showFrontalandTemporalregionsAssociated PRs
Checklist
@jcmosher @Nastaranlotfi @yashvakilna