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

Fix #35 - "bottom cannot be >= top" matplotlib error #52

Merged
merged 2 commits into from
Apr 3, 2020

Conversation

bergercookie
Copy link
Contributor

Matplotlib emits errors like the following under specific canvas layouts:

Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/data_plot/mat_data_plot.py", line 107, in resizeEvent
    self.figure.tight_layout()
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1756, in tight_layout
    self.subplots_adjust(**kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1612, in subplots_adjust
    self.subplotpars.update(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 230, in update
    raise ValueError('bottom cannot be >= top')
ValueError: bottom cannot be >= top

Current patch catches and suppresses the exception.

References:

bergercookie and others added 2 commits April 3, 2020 18:19
Matplotlib emits errors like the following under specific canvas
layouts:

```console
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/data_plot/mat_data_plot.py", line 107, in resizeEvent
    self.figure.tight_layout()
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1756, in tight_layout
    self.subplots_adjust(**kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1612, in subplots_adjust
    self.subplotpars.update(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 230, in update
    raise ValueError('bottom cannot be >= top')
ValueError: bottom cannot be >= top
```

Current patch catches and suppresses that exception.

References:
- matplotlib/matplotlib#10915
- ros-visualization#35
@dirk-thomas
Copy link
Contributor

I renamed the method to safe_tight_layout() and inverted the version comparison logic to avoid duplicating the invocation of the original method. Hope that makes sense.

@bergercookie
Copy link
Contributor Author

Sure, makes sense.

@dirk-thomas
Copy link
Contributor

Thanks for the patch!

@dirk-thomas dirk-thomas added the bug label Apr 3, 2020
@dirk-thomas dirk-thomas merged commit cb7d874 into ros-visualization:master Apr 3, 2020
dirk-thomas added a commit that referenced this pull request Apr 3, 2020
* Fix #35 - "bottom cannot be >= top" matplotlib error

Matplotlib emits errors like the following under specific canvas
layouts:

```console
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_plot/data_plot/mat_data_plot.py", line 107, in resizeEvent
    self.figure.tight_layout()
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1756, in tight_layout
    self.subplots_adjust(**kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1612, in subplots_adjust
    self.subplotpars.update(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 230, in update
    raise ValueError('bottom cannot be >= top')
ValueError: bottom cannot be >= top
```

Current patch catches and suppresses that exception.

References:
- matplotlib/matplotlib#10915
- #35

* renamed to `safe_tight_layout`, inverted logic to avoid duplicating the call

Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
@dirk-thomas
Copy link
Contributor

Cherry-picked to crystal-devel: e33182b.

@bergercookie
Copy link
Contributor Author

@dirk-thomas , Is this also going to be backported to melodic?

@dirk-thomas
Copy link
Contributor

Is this also going to be backported to melodic?

The master branch of this repository is being used by all active ROS 1 distros.

rhaschke added a commit to rhaschke/rqt_plot that referenced this pull request Feb 4, 2021
@rhaschke rhaschke mentioned this pull request Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants