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

Adding custom text to a graph causes it to go blank #3127

Open
jamescrake-merani opened this issue Oct 17, 2024 · 2 comments
Open

Adding custom text to a graph causes it to go blank #3127

jamescrake-merani opened this issue Oct 17, 2024 · 2 comments

Comments

@jamescrake-merani
Copy link
Contributor

Describe the bug
I've tested this both on Mac, and Ubuntu though I don't have a Windows machine on hand to test with. The error seems more reproducible on Mac as it doesn't seem to always occur on Ubuntu.

To Reproduce
Steps to reproduce the behavior:

  1. Load in some data, and do a fit
  2. Right click on one of the graphs, and add custom text
  3. On Mac this is enough to reproduce the error in my testing but on Ubuntu you might need to resize the graph before it goes blank.

Expected behavior
Custom text should get added onto the graph.

Screenshots
image

SasView version:

  • Version: SasView RC2

Operating system:

  • OS: Ubuntu 24.04, and Mac OS Sonoma 14.6.1

Additional context
This is the error that gets printed to the console:

  File "matplotlib/backends/backend_qt.py", line 498, in _draw_idle
  File "matplotlib/backends/backend_agg.py", line 387, in draw
  File "matplotlib/artist.py", line 95, in draw_wrapper
  File "matplotlib/artist.py", line 72, in draw_wrapper
  File "matplotlib/figure.py", line 3156, in draw
  File "matplotlib/layout_engine.py", line 183, in execute
  File "matplotlib/_tight_layout.py", line 266, in get_tight_layout_figure
  File "matplotlib/_tight_layout.py", line 82, in _auto_adjust_subplotpars
  File "matplotlib/artist.py", line 1412, in _get_tightbbox_for_layout_only
  File "matplotlib/_api/deprecation.py", line 457, in wrapper
  File "matplotlib/axes/_base.py", line 4499, in get_tightbbox
  File "matplotlib/artist.py", line 365, in get_tightbbox
  File "matplotlib/text.py", line 960, in get_window_extent
  File "matplotlib/text.py", line 897, in get_unitless_position
TypeError: float() argument must be a string or a real number, not 'NoneType'

I'll take a look at the error, and see if I can fix it.

@jamescrake-merani
Copy link
Contributor Author

I've opened a pull request which fixes this issue. However, while doing so, I uncovered some more issues with this feature. It seems to break whenever you set a font to anything other than the default. Fixing this would require more changes, and at this point I'm not sure if this work should be a priority especially when we are so close to release. Furthermore, I understand Julius' work overhauls the plotting so this might not be an issue in his branch anyway.

@krzywon
Copy link
Contributor

krzywon commented Oct 17, 2024

I am unable to reproduce this on Windows, which means I am unable to test if the fix works or not. I'll test on my Mac shortly.

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

When branches are created from issues, their pull requests are automatically linked.

2 participants