Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi line plot dose not work as expected #413

Open
ziyuanbaby opened this issue Jul 5, 2024 · 0 comments
Open

multi line plot dose not work as expected #413

ziyuanbaby opened this issue Jul 5, 2024 · 0 comments

Comments

@ziyuanbaby
Copy link

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.
image

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();

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant