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

Warning: empty y range [0:0], adjusting to [-1:1] #338

Open
2 of 8 tasks
aminya opened this issue May 3, 2023 · 2 comments
Open
2 of 8 tasks

Warning: empty y range [0:0], adjusting to [-1:1] #338

aminya opened this issue May 3, 2023 · 2 comments
Labels
bug - runtime warning cross-platform issue - linux Help wanted - Good for contributing if you are on linux

Comments

@aminya
Copy link
Contributor

aminya commented May 3, 2023

Bug category

  • bug - compilation error
  • bug - compilation warning
  • bug - runtime error
  • bug - runtime warning
  • bug - logic error

Describe the bug

When building subplots with the gnuplot backend, even though the ylim is set, I still get this warning during the plot:

Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]

Steps to Reproduce

Try using figure axes and and add_subplot

auto fig_ax = fig->add_subplot(..., ...);
fig_ax->ylim({-1,1});
fig_ax->plot(...,...);

Output

Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]
Warning: empty y range [0:0], adjusting to [-1:1]

Platform

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: Kubuntu
  • OS Version: 22.04
  • Compiler: Clang
  • Compiler version: 15

Additional context

@github-actions github-actions bot added bug - runtime warning cross-platform issue - linux Help wanted - Good for contributing if you are on linux labels May 3, 2023
@Keith-Dao
Copy link

I just ran into this warning recently as well. The following removed the runtime warnings for me:

auto fig_ax = fig->add_subplot(..., ...);
matplot::yrange(fig_ax, {-1,1});
fig_ax->plot(...,...);

Hope this helps.

@alandefreitas
Copy link
Owner

Yes. Because of how pipes work there's no two-way communication between gnuplot and matplot. The only solution is to preemptively adjust the ranges to avoid the warnings. matplot could attempt to do that automatically internally, but the logic might become quite complex is some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - runtime warning cross-platform issue - linux Help wanted - Good for contributing if you are on linux
Projects
None yet
Development

No branches or pull requests

3 participants