multi line plot dose not work as expected
Opened this issue · 0 comments
ziyuanbaby commented
Discussed in #412
Originally posted by ziyuanbaby July 5, 2024
using namespace matplot;
hold(on);
for (int i = 0; i < 5; i++)
{
std::vector<double> x = linspace(0, pi);
std::vector<double> y1 = transform(x, [&](auto x)
{ return cos(x * (i + 1)); });
plot(x, y1, "-o");
}
legend();
show();
the above code draw 5 lines. but only the first one is shown on the figure.
however, when i only draw three lines, it works as expected. can anyone tell me where i am doing wrong?
using namespace matplot;
hold(on);
for (int i = 0; i < 3; i++)
{
std::vector<double> x = linspace(0, pi);
std::vector<double> y1 = transform(x, [&](auto x)
{ return cos(x * (i + 1)); });
plot(x, y1, "-o");
}
legend();
show();