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

all plot be hidden default. #572

Open
Sologala opened this issue May 29, 2024 · 2 comments
Open

all plot be hidden default. #572

Sologala opened this issue May 29, 2024 · 2 comments

Comments

@Sologala
Copy link

I will plot multi lines in one frame, but do not want show all of them in beginning.
Is there some way to disable all lines in legend?

image

@Sologala
Copy link
Author

I can directly modify plotitem's member variable to achive that, but it needs to include implot_internal.h.
Is there some elegant way to do this?

      if (first_draw) {
                    first_draw = false;
                    ImPlotContext *ctx = ImPlot::GetCurrentContext();
                    ImPlotPlot *plot = ctx->CurrentPlot;
                    const int num_items = plot->Items.GetLegendCount();
                    for (int i = 0; i < num_items; ++i) {
                        ImPlotItem *item = plot->Items.GetLegendItem(i);
                        item->Show = false;
                    }
                }

``

@djbarker
Copy link

djbarker commented Sep 4, 2024

Am also interested in achieving this.

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

2 participants