scalanlp/breeze

breeze.viz : plot two objects in same color

開放

#701 建立於 2018年3月22日

 (2 則留言) (0 個反應) (0 位負責人)Scala (690 個分叉)batch import
good first issue

倉庫指標

星標
 (3,453 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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!

貢獻者指南