You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I'm posting this in Discussions as opposed to Issues because I'm not actually sure if I'm doing something wrong. I'm trying to plot a line of slope 2 in log-log space, with x-values ranging from 1e-8 to 1e0. However, the matplot loglog plotter seems to be throwing out quite a few of the points, namely, those with y-values less than 1e-10. (For reference, the first 100 or so y-values range between 1e-16 and 1e-10). I'd really appreciate it if somebody could take a look and let me know if I've done something wrong, or if I should submit this as a bug report. I've included a minimal working version of my code, as well as the plot it produces. Thank you!
#include <iostream> #include <matplot/matplot.h> int main(int argc, char **argv) { // Number of data points int N = 1000; // Generate N logspaced X values between 10^-8 and 10^0 double start = -8; double end = 0; std::vector<double> t = matplot::logspace(start, end, N); // Y values (slope 2 in log space) std::vector<double> log_slope_2(N); // Compute log slope 2 line for (int i = 0; i < N; i++) { log_slope_2[i] = std::pow(10, 2*log10(t[i])); } // Uncomment to print points to command line // for (int i = 0; i < N; i++) { // std::cout << "(" << t[i] << ", " << log_slope_2[i] << "), "; // } // std::cout << std::endl; auto plt = matplot::loglog(t, log_slope_2); plt->line_width(2); matplot::show(); return 0; }
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I'm posting this in Discussions as opposed to Issues because I'm not actually sure if I'm doing something wrong. I'm trying to plot a line of slope 2 in log-log space, with x-values ranging from 1e-8 to 1e0. However, the matplot loglog plotter seems to be throwing out quite a few of the points, namely, those with y-values less than 1e-10. (For reference, the first 100 or so y-values range between 1e-16 and 1e-10). I'd really appreciate it if somebody could take a look and let me know if I've done something wrong, or if I should submit this as a bug report. I've included a minimal working version of my code, as well as the plot it produces. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions