scalanlp/breeze

breeze.viz : plot two objects in same color

Open

#701 aberto em 22 de mar. de 2018

Ver no GitHub
 (2 comments) (0 reactions) (0 assignees)Scala (690 forks)batch import
good first issue

Métricas do repositório

Stars
 (3.453 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Hello,

on several occasions already I needed to plot two objects (eg. dots and a line) in the same color. I would like to avoid specifying the color explicitly but rather use the builtin palette to be robust against possible future changes.

I've checked the plot/package.scala and the plot/PaintScale.scala implementation to find a way, but I do not see anything like this implemented. Do you have any idea?

My next try would have been to explicitly pass the palette PaintScale.Category10 to plot, but it only accepts colorcode: String. A conversion function, the inverse of PaintScale.convertToColor doesn't exist. Do you know a work-around?

Alternatively, would you be interested in a PR for either one of those:

  • a new argument to plot, namely color: java.awt.Color to use it like this: color=PaintScale.Category10(1) to get the same color as the second plot
  • an inverse conversion function (might be hard to maintain)
  • a new magic string to pass to colorcode, indicating to take the same color as plot number x, e.g. colorcode="plot1" to use the same color as the second plot.

Cheers!

Guia do colaborador