When an entry for u or v is all zeros, the scaling results in u_scaled/v_scaled to have nans due to a division by u_max, v_max.
Steps to Reproduce
#include <cmath>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
// Produces 10 entries
auto x = iota(0, 2.0 / 20, 2);
auto y = iota(0, 2.0 / 20, 2);
// Produces 10 entries
std::vector<double> theta;
for (int t = 0; t < x.size(); t++) {
theta.push_back(0 + 2 * M_PI / x.size() * t);
}
auto u =
transform(theta, [](double theta) { return 1; });
auto v =
transform(theta, [](double theta) { return 0; });
quiver(x, y, u, v);
show();
return 0;
}
Output
Empty plot with the following console output:
```console
Press ENTER to continue... line 21: warning: Skipping data file with no valid points
multiplot> plot '-' with vectors linecolor rgb "0x000071BC" dashtype 1 linewidth 0.5 linetype -1
^
line 21: x range is invalid
line 42: warning: Skipping data file with no valid points
multiplot> plot '-' with vectors linecolor rgb "0x000071BC" dashtype 1 linewidth 0.5 linetype -1
^
line 42: x range is invalid
line 42: warning: refresh not possible and replot is disabled
line 42: warning: refresh not possible and replot is disabled
line 42: warning: refresh not possible and replot is disabled
line 42: warning: refresh not possible and replot is disabled
```
Bug category
Describe the bug
When an entry for
u
orv
is all zeros, the scaling results inu_scaled
/v_scaled
to have nans due to a division byu_max
,v_max
.Steps to Reproduce
Output
Platform
Environment Details:
gcc
gcc-12.1.0
Additional context
Related discussion, which prompted me in discovering this bug: https://github.com/alandefreitas/matplotplusplus/discussions/278