[3/3] Fastgraph: Plot Fastgraphs - #916
Draft
chinmaychinara91 wants to merge 59 commits into
Draft
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
chinmaychinara91
marked this pull request as ready for review
May 1, 2026 20:53
Member
|
@chinmaychinara91, To be reviewed, this PR should updated to be compatible with the changes in PR #911 and PR #912 |
rcassani
marked this pull request as draft
June 9, 2026 13:59
- Rename processes as per the changes in PR brainstorm-tools#911 and brainstorm-tools#912 - Adding `ODD` and `EVEN` events not part of the tutorial (left at user's discretion with a note added to the tutorial about it). As recommended by @jcmosher.
chinmaychinara91
marked this pull request as ready for review
June 18, 2026 02:47
rcassani
requested changes
Jun 18, 2026
rcassani
left a comment
Member
There was a problem hiding this comment.
Please address the comments and perform the required changes.
Member
There was a problem hiding this comment.
There is code to do this in Brainstorm. There is no need to add this external code.
See it in: figure_timefreq('GetLayoutPositions'). This is called when TF maps for all channels.
| plotWindowIdx = OPTIONS.PlotWindow(1) + 101 : OPTIONS.PlotWindow(2) + 101; | ||
| timeMs = seegData{iSubplot}.Time(plotWindowIdx) * 1000; | ||
|
|
||
| fprintf('\n===== Fastgraph %d/%d: Stimulation site "%s" =====\n', iSubplot, numel(sInputs), sInputs(iSubplot).Comment) |
Member
Author
There was a problem hiding this comment.
Added it in order to help the separate the display info for left and right contacts per FastGraph in the command window. But feel free to edit as you see fit.
Member
|
@chinmaychinara91, the file |
- Cleanup - Overwrite files when removing SPES artifcts and drift - Better organize imported files - Update call to `process_fastgraph`
rcassani
force-pushed
the
plot-fastgraphs
branch
from
July 27, 2026 15:17
7554c96 to
90ec8a7
Compare
rcassani
marked this pull request as draft
August 3, 2026 16:28
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 (

| rm spes | emd) toProcess1tab >Run > Import > Import recordings > Import MEG/EEG: Events. Set event name asSTIMand epoch time-100to900ms. For this sample data, we will be importing all theSTIMevents 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 theSTIMevents of the stimulation block earlier now helps in creating separate groups, else all would have clustered under one.Drag the

STIMgroups toProcess1tab and average them by trial to get as under.Ideally do it for all the 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 > FAST graph > Plot Fastgraphsand set the values as shown in the process GUI image above to get the plot as under.RMS).Avg: STIM B'3-B'4 #1Fastgraph, theparahippocampal Lgave the highest response, inAvg: STIM B3-B4 #1it wasparahippocampal Rand inAvg: STIM A11-A12 #1it wassuperiortemporal RLandRindicating above the x-axis represent the left hemisphere responses and below it represents the right hemisphere responses.Some more examples
Color by

Region| Select region(s) to include:FrontalandTemporalColor by

Label| Select region(s) to include: Select allColor by

Label| Select region(s) to include:FrontalandTemporalSelect scouts:

parahippocampal L,parahippocampal R,superiortemporal R| Color byRegion| Select region(s) to include: Select allSelect scouts:

parahippocampal L,parahippocampal R,superiortemporal R| Color byLabel| Select region(s) to include: Select allAssociated PRs
Checklist
For now good first draft for testing the end-to-end results, but might need changes based on the tutorial page.The tutorial data is here.@jcmosher @Nastaranlotfi @yashvakilna