alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.24k stars 325 forks source link

Small X-axis increments are not plotted correctly #365

Open aWZHY0yQH81uOYvH opened 1 year ago

aWZHY0yQH81uOYvH commented 1 year ago

Bug category

Describe the bug Small x-axis increments are skipped/averaged together to create a stair-stepped plot. I assume there is an epsilon constant somewhere which should probably be set much smaller than 1e-5 (or made to be dynamic with the given x values).

Steps to Reproduce

vector<double> x = linspace(0, 1e-4, 1000);
plot(x, transform(x, [](double x) {return sin(2*M_PI*1e4*x);}));
show();

Output

badsine_dark

If 1e-4 is replaced with 1 in the above code, the result is correct. oksine_dark

Platform

Environment Details: