Pangolin icon indicating copy to clipboard operation
Pangolin copied to clipboard

How to add legend in showed window?

Open evertale888 opened this issue 1 year ago • 2 comments

Lets say i plotted many rectangles in one window with different color. These rectangle represent certain objects that i mapped from picture. The rectangles are just constructed with lines only, means inside is empty. So one color used for each rectangle. How can i add legend for each color of these rectangles in the corner of the window, possibly in the below area of the buttons etc, as it got more free space there?

evertale888 avatar Feb 21 '24 07:02 evertale888

Pangolin has no built-in support for legends / keys, but based on what you describe, you might be asking - "how do I draw colored text?"

One example can be found here https://stevenlovegrove.github.io/Pangolin/emscripten/examples/SimplePlot/ and the code for that is https://github.com/stevenlovegrove/Pangolin/blob/master/components/pango_plot/src/plotter.cpp#L620. It isn't so simple because it uses a custom shader, but could be useful as a starting point if you are so inclined.

stevenlovegrove avatar Mar 07 '24 06:03 stevenlovegrove

Pangolin has no built-in support for legends / keys, but based on what you describe, you might be asking - "how do I draw colored text?"

One example can be found here https://stevenlovegrove.github.io/Pangolin/emscripten/examples/SimplePlot/ and the code for that is https://github.com/stevenlovegrove/Pangolin/blob/master/components/pango_plot/src/plotter.cpp#L620. It isn't so simple because it uses a custom shader, but could be useful as a starting point if you are so inclined.

Thanks for the replied. This helps a lot.

evertale888 avatar Mar 07 '24 06:03 evertale888