plot/palette: clean up API
@kortschak 已經在處理了。
開始於 2017年4月30日。
評估
這個 Issue 還沒有評估資料。
描述
I am troubled by the size of the ColorMap interface. It can be reduced in size to
// A ColorMap maps scalar values to colors.
type ColorMap interface {
// At returns the color associated with the given value.
// If the value is not between Max() and Min(), an error is returned.
At(float64) (color.Color, error)
// Min returns the current minimum value of the ColorMap.
Min() float64
// Max returns the current maximum value of the ColorMap.
Max() float64
// Palette returns a new Palette with the specified number of
// colors from the ColorMap.
Palette(colors int) Palette
}
and
// DivergingColorMap maps scalar values to colors that diverge from a central value.
type DivergingColorMap interface {
ColorMap
// ConvergePoint returns the value where the diverging colors meet.
ConvergePoint() float64
}
The Set methods are required because the concrete types are not exported. This can be fixed with minor name juggling on the field names of the concrete types. For example:
// Luminance is a color palette that interpolates between control colors in a way that
// ensures a linear relationship between the luminance of a color and the value it represents.
// NewLuminance must be used to create a usable Luminance.
type Luminance struct {
// colors are the control colors to be interpolated among.
// The colors must be monotonically increasing in luminance.
colors []cieLAB
// scalars are the scalar control points associated with
// each item in colors (above). They are monotonically
// increasing values between zero and one that correspond
// to the luminance of a given control color in relation
// to the minimum and maximum luminance among all control
// colors.
scalars []float64
// Alpha represents the opacity of the returned colors in
// the range (0,1). NewLuminance sets Alpha to 1.
Alpha float64
// Range specifies the minimum and maximum values of the
// range of scalars that can be mapped to colors using this
// ColorMap.
Range struct { Min, Max float64 }
}
- 主要語言
- Go
- 星號
- 3k
- 分支
- 202
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
gonum/plot 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 35/100
-
難度 2/5 1-3 小時 新手友好度 52/100
-
難度 5/5 一週以上 新手友好度 32/100
-
plot/plotter: NewHist(binPoints) panic when a small negative number is used可能已有人在做 @SashaMIT 於 18 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 55/100
-
難度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 72/100
slavakurilyak/awesome-ai-agents#888 ·
維護者通常 1 天內回覆
-
enhancement nav-pilot
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
kind/enhancement
難度 2/5 1-3 小時 新手友好度 64/100
維護者通常 1 天內回覆
-
feat(gmail): make gmail get --format raw text output the exact message, like drafts get --format raw未關閉clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
難度 2/5 1-3 小時 新手友好度 78/100
openclaw/gogcli#1276 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
Seed a JRNYAx price before the last close so asset-detail S1.3 doesn't fail from 08:00Z to the open未關閉bug tests
難度 2/5 1-3 小時 新手友好度 83/100
lognorman20/monaco#7231 ·