[ENH] Plot style managment#176
Conversation
|
So, functionally, something in here is not playing well plot functions attached to the FOOOF object. Example code to show the issue: Issues:
Note that if you call the plot function directly, the color scheming still goes wrong, but the saving works I think this is an interaction between all the different style functions. There's a lot of decorating going on (my fault). I don't understand the save thing. For the color, I think there's an interaction between all the styling that isn't going well. I think a general ToDo here might be to merge & consolidate a bit between the current FOOOF styling approach, and the we aspects e are trying to add, because they are not totally playing nice together, and I feel like we're getting a lot of complexity here. |
|
I think an issue here is that for some of the plots we end up with two styling approaches - using both So, here's something relevant. The current / old FOOOF styling does check and style because it takes arguments. This is because the style func needs to know if axes are in log space. At the time I couldn't figure out how to do so without arguments passed in from inside the plot function, which doesn't play nice with the decorators. But - brainwave. We can avoid arguments to the spectrum style function by annotating the plot axis with custom attributes! Here's a simple code example to demonstrate the point: I think this is quite relevant here, because we can try and do away with the whole Anyways - just thoughts so far - I think we do need to simplify plot style management overall here, which I'm hoping will address the current bugs along the way. |
|
I've spent a few days trying to figure out how to get everything to play nicely together with your suggestion and it's been difficult. There is a lot going on in the ways the two packages creates plots. I agree that we need to consolidate/simplify to one approach. |
|
Hi @TomDonoghue, I finally figured this one out. I took your advice and removed The original color issue you noted should be resolved. I checked other functionality by rebuilding the site and ensuring all graphs were the same. Everything should be behave like ndsp now. I also updated tests to save plots (#180). |
|
Okay, @ryanhammonds - sorry for the ludicrous amount of delay on me getting back to this one. It just seemed like a slightly intimidating PR to get into, since it had a lot of changes and seemed like it would take a lot of time, so I never quite got around to it. Luckily, I was generally wrong that it was intimidating - overall, this update is really nice, and really clean. Thanks a ton for digging through all this and doing the work on this one - I'm super happy with the result. I did a couple small lints, some small tweaks, and slightly extended the styling to collection plot elements. I think this is all good now - to get things moving, I'm going to merge this in now! |
This PR addresses #174 and expands plot styling similar to neurodsp. Here is a summary of the changes:
plot_styleandsavefigadded, based on neurodsp's implmentation.The
plotmethod ofFOOOFandFOOOFGroup, accepts kwargs for these new decorators.plts.aperiodic,plts.periodic,plts.error,plts.spectra, are decorated withplot_styleandsave_fig.I didn't decorate the functions in
plts.annotate. Only plots with one axes were decorated, with the exception ofFOOOFGroup.plot. This was because > 1 axes with varying number of lines per axis became increasing difficult to decorate properly.Related tests have been updated.