Skip to content

plot: Manual legend manipulation #9

@tingerrr

Description

@tingerrr

I have a plot like so:
image

Which is constructed sort of like this:

#cetz.chart({
  plot.add(label: $n'_min$, ...)
  plot.add(label: $n'_max$, ...)
  for value in values {
    plot.add(style: palette.purple, label: if value.t == 1 { $n$ })
  }
})

This is obviously simplified, but it should across what kind of structure the data has that I'm visualizing.

I would like to add an entry to the legend which more clearly communicates that n is every line in the purple palette, without actually adding 7 different lines.

Currently, there doesn't seem to be a way to easily add some entry to the legend of a plot manually, or for a group of elements in the plot. Ideally, I would manually add an item to the plot at the end, such that it renders a gradient of the palette. Alternatively, I could somehow tell the plot that they all share a label, and it would figure it out from their chosen colors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions