Originally posted by **ziyuanbaby** July 5, 2024
```
using namespace matplot;
hold(on);
for (int i = 0; i < 5; i++)
{
std::vector x = linspace(0, pi);
std::vector 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.
![image](https://github.com/alandefreitas/matplotplusplus/assets/35264651/8743f1d6-ba4f-405a-92ba-ea3e48cecae6)
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 x = linspace(0, pi);
std::vector y1 = transform(x, [&](auto x)
{ return cos(x * (i + 1)); });
plot(x, y1, "-o");
}
legend();
show();
```
![image](https://github.com/alandefreitas/matplotplusplus/assets/35264651/04f45b54-6bde-4b84-b8db-7eff991f0df8)
Discussed in https://github.com/alandefreitas/matplotplusplus/discussions/412