0

I have a figure with several axes open. The main axis holds a data plot. Another holds a slider to control a variable, which in turn affects the plot (works fine). Another holds a "homemade" legend with checkboxes (using a modified version of the CheckButton widget class), which also affect the plot (works fine). Lastly, an axis holding a Button widget instance to generate a plot based on the current main plot data (works fine). These are all plotted using matplotlib from Spyder with the Qt5agg interactive backend.

Okay, here's what I'm having issues with. Upon window resizing, all of my figures resize to match their predefined scaling (which I believe are in normalized units, where (0,0) is bottom left of figure, and (1,1) its top right). In my scenario, I would like to disable this relative scaling for all axes but the main plot axis. This should theoretically be possible, as this is the behavior observed by any given plot's legend. Matter of fact, I was able to accomplish this for the "homemade" legend object (with checkboxes) by interacting with the legend class.

Is there a way to see matplotlib's Legend class code? Or better yet, to know which part of it covers this resize prevention protocol? Essentially, the endgame is to give axes absolute, and not relative size.

The only other question I found for this type of issue is the following:

matplotlib: resize figure window without scaling figure content

Unfortunately, no good resolution found...

Any help is greatly appreciated!

  • I think some of the answers to the linked question are useful to your problem. What different answer would you expect here? – ImportanceOfBeingErnest Jan 24 '19 at 15:36
  • It would be nice if an axes object had something like ax.STOP_RESIZING!!!(). Alas... I actually found my way into the legend class this morning. It seems to just have a more "in-depth" draw function to recalculate its size according to the its axis' scaled size. An ideal STOP_RESIZING function would perhaps disconnect from the relative size reference. Better yet, is there a way to define an axes object in absolute units instead of relative to the figure? That'd be nice. – Edan Bainglass Jan 25 '19 at 16:07
  • The axes doesn't actually resize. It's more that its position is defined relative to the figure. Hence the solutions to this are all somewhat convoluted. Did you try any of them? Do they not work? – ImportanceOfBeingErnest Jan 25 '19 at 16:12
  • I haven't, but I can tell that they would achieve the requirement. However, I'm determined to find a way to disconnect the relative reference (its sport to me). Perhaps there it isn't a matplotlib matter and more of a interface matter... – Edan Bainglass Jan 25 '19 at 16:26
  • You can stop the complete figure from resizing. Is [that](https://stackoverflow.com/a/42624276/4124317) what you mean? Else, be aware that there is no way to "disconnect" the relative reference, but you'd rather "replace" that by some other transform. – ImportanceOfBeingErnest Jan 25 '19 at 17:43

0 Answers0