Skip to content

Comments

Feat: Different types of legend icon#680

Open
brenocq wants to merge 1 commit intomasterfrom
feat/improve-legend-icons
Open

Feat: Different types of legend icon#680
brenocq wants to merge 1 commit intomasterfrom
feat/improve-legend-icons

Conversation

@brenocq
Copy link
Collaborator

@brenocq brenocq commented Feb 17, 2026

Closes #569
Closes #160

Image Image

Image Image

Improved Legend Icons

Summary

Legend icons now accurately represent the plot type instead of always showing a solid square.

Changes

  • Line plots: Display as horizontal lines in legend
  • Line plots with markers: Display as horizontal line with centered marker
  • Scatter plots: Display as single marker (no line)
  • Filled plots (shaded, pie, heatmap, digital): Display as filled square
  • Bar plots/histograms: Display as filled square with outline

Implementation

  • Added ImPlotLegendIconType_ enum with 5 icon types: Line, LineMarkers, Markers, Fill, FillLine
  • Extended ImPlotItem to store legend rendering data (colors, marker type, line weight, icon type)
  • Added RenderLegendIcon() to render icons based on type
  • Each plot function explicitly sets its icon type when calling BeginItem()
  • Markers in legend are consistently sized at 0.5× icon width

Technical Details

  • Icon type is determined per-plot-type
  • Legend icons respect the same color properties as the plot (line color, fill color, marker colors)
  • Icons respond to hover/held/disabled states with alpha modulation
  • No breaking changes to public API

@brenocq brenocq self-assigned this Feb 17, 2026
@brenocq brenocq added type:feat New feature or request prio:high High priority status:review The task is under review labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:high High priority status:review The task is under review type:feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

marker shapes in legend Legend enhancement

1 participant