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

[MRG] feat: post-processing function to adjust figures #893

Merged

Conversation

gtdang
Copy link
Collaborator

@gtdang gtdang commented Sep 18, 2024

Added a post-processing function to adjust figures after they have been constructed

This was created for a special case where L2 and L5 dipole plots should have the same axis limits. There wasn't a simple way to set axis limits upon plot creation so the post-process implementation seemed like the most simple solution while keeping the current APIs intact.

Admittedly this solution is a bit hacky as it renders the first set a plots and quickly re-renders the adjustment (looks like a flicker). Perhaps adding keywords to not render certain plot calls would be a solution.

Screenshot 2024-09-18 at 5 08 55 PM

…e been constructed

This was created for a special case where L2 and L5 dipole plots should have the same axis limits. There wasn't a simple way to set axis limits upon creation so the post-process seemed like the most simple solution while keeping the current api intact.
@gtdang gtdang changed the title feat: post-processing function to adjust figures [WIP] feat: post-processing function to adjust figures Sep 19, 2024
The self.figs attribute is a dictionary with int keys. We obtain the latest figure by using the stored figure index from the data attribute.
@gtdang gtdang changed the title [WIP] feat: post-processing function to adjust figures [MRG] feat: post-processing function to adjust figures Sep 19, 2024
@gtdang gtdang marked this pull request as ready for review September 19, 2024 20:35
@gtdang gtdang mentioned this pull request Sep 19, 2024
3 tasks
# template post-processing
fig_key = self.data['fig_idx']['idx'] - 1
_postprocess_template(template_name,
fig=self.figs[fig_key],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntolley
This was the PR I was showing you that was glitching and preventing further figure creation after deleting figures a few times. The issue was at this line where I was previously indexing self.figs with a the length of itself, because I assumed it was a list and I wanted the latest created figure. Turns out thatself.figs is a dict with ints as keys and the length of the dict doesn't correspond to the keys after you delete from and add to it. Using the int stored in self.data['fig_idx']['idx'] as the key fixed the issue.

@ntolley
Copy link
Contributor

ntolley commented Sep 26, 2024

@gtdang are we sure all the plots are being iterated over to find ymin/ymax? The 3rd plot seems to have different ylims here:
image

@ntolley ntolley merged commit b68729c into jonescompneurolab:master Sep 26, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants