ISISNeutronMuon / ISISNeutronMuon/MDMC
Dynamic plots increase in size after refinement completion in some environments
- Dominant language
- Python
- Stars
- 4
- Forks
- 0
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 5
Description
**Description of the error**
See #464 for description of bug, but to summarise: On Anders' Windows 10 machine using Docker for installation and running the following:
```
from MDMC.utilities.plotting import plot_progress
control = plot_progress(control, 'FoM')
control.refine(10)
```
**Describe the expected result**
Plot of `FoM` against `n_steps` which dynamically updates after each refinement step (referred to hereafter as the dynamic plots), and then remains constant after refinement finishes (i.e. after `control.refine(10)` has executed) (referred to hereafter as the static plots).
**Describe the actual result**
The dynamic plots are the correct size but this increases to approximately double the size for the static plots at the end.
**Suggested fix**
This is difficult to say because I can't reproduce the bug. It is probably related to the `matplotlib.figure.canvas._dpi_ratio` which I observed when creating the dynamic plotting (see comment in `plot_progress`) which resulted in the dynamic plots being half sized but the static end plot being the correct size. It is possible that this could be solved by using the `matplotlib.figure.canvas.handle_set_dpi_ratio` (see [here](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_webagg_core.py) for relevant code) method, however I couldn't get this to have the desired effect when I tried initially, although I wasn't passing an `event`, but just a `dict`. Alternatively it might be necessary to see either report this bug to matplotlib and let them sort it out, or switch to plotly as the plotting backend (although I also struggled to get dynamically updating plots within a loop working with plotly).
**Additional details**
The urgency of fixing this bug is rather dependent on the frequency with which people observe this bug - so far it has only been tested on a few environments and only experienced on one.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.