question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More control over plot settings

See original GitHub issue

Describe the new feature or enhancement

Would it be possible to give users more control over (some of the) plotting parameters? in my case, I wanted to plot multiple ERPs in a single figure. WIth plot_evoked, I could extract all the axes and gather all the plots in a single figure, however, the layout was not really nice (a lot of whitespace). I wished to constrain the layout, but couldn’t do so because in plot_evoked set_tight_layout is hardcoded to True, which is incompatible with a constrained layout.

Describe your proposed implementation

If I understand the structure correctly, there are front-end auxiliary plotting functions that users interact with and the actual plotting functions that are called in the background and do the plotting. As it seems, only a subset of the arguments that the plotting functions have are being used by those auxiliary functions. Would it be possible to pass those “hidden” arguments as kwargs? Like that the API would not be cluttered with secondary plotting parameters, but still allow for more flexibility?

Additional comments

As mentioned before, I only had a look at the plot_evoked function. I don’t know in how far something similar is also relevant for other plotting functions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
agramfortcommented, Nov 30, 2020

you tried to do the right thing

set_tight_layout

should probably not be used systematically.

regarding kwargs I prefer to avoid them as much as possible as they are almost impossible to document and can lead to silent bugs

can you open a PR with the changes that are necessary to address your needs and looking at the diff we see how to move forward?

0reactions
eortcommented, Dec 2, 2020

I am keen to hear your “laundry list” — are there things other than adding titles that you are finding difficult to accomplish?

So far, I haven’t encountered much that I had trouble with, as I just started optimizing the visualization of my data. What might be relevant to you is:

  • inconsistent parameter naming for passing axes (sometimes ax as in plot_raw_psd, sometimes axes as in plot_evoked)
  • the interactions with the plot were confusing whenever more than one axis is returned (encountered in plot_evoked). For example, even though I passed only two axes each on two separate calls to the function into the function, four axes got returned for each call. Other things were that adding titles/subtitles as well as x/y labels confused me e.g. labels disappeared). Eventually it looked like what I would have expected, but I don’t know what caused the issue in first place and how it was resolved (probably mistakes on my end)

Here are also a few other plot-related things that came to my mind, in a wider sense of your question:

  • when plotting raw data (in plot_raw). I would like to group the channels by more than one variable (i.e. location and type). I haven’t tried whether this could be done by combining the group_by and the picks arguments, though.
  • when plotting epochs, I would like to be able to merely mark epochs without instantly dropping them. So, storing indices of to-be-dropped epochs in the epoch instance and drop them later with an explicit dropping call.
  • it would be cool to have a waterfall plot added to mne’s plotting functions. That is basically a 3d version of plot_image. I have seen power spectra plotted in that way (over frequencies and trials) and was impressed how nicely noisy trials can be identified. But yeah, given that this would be a 3d-plot it probably doesn’t fit your agenda.

As I said, I haven’t spend a lot of time exploring all the ways to amend mne plots. It is quite likely that I have just missed obvious solutions. I will be spending quite a bit of time in the next weeks with plotting. I will report here (or in #7751) whenever I encounter something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlling Plot Options and Orientation - YouTube
Learn how to adjust print and plot options and orientation on the paper in AutoCAD 2016.To learn more visit http://cadlearning.com.
Read more >
Using plot style tables in AutoCAD
Method #3. On the Start menu (Windows), click Settings > Control Panel. In Control panel, double-click Plot Style Manager.
Read more >
PAGE SETUPS AND PLOT STYLE - Evolve Consultancy
AutoCAD uses page setups to control layout settings and plotter properties. Page setups can be saved and applied to multiple layouts in the...
Read more >
Taking Control of Plot Scaling - Tidyverse
Attempt 2: Theming. One approach to fixing this is by changing the theme settings of the plot, so that they work better for...
Read more >
Control How Plotting Functions Select Colors and Line Styles
You can change the colors, line styles, and markers of plot objects by modifying the ColorOrder or LineStyleOrder properties of the axes, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found