plot/palette: clean up API
@kortschak arbeitet bereits daran.
Seit 30.4.2017.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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 }
}
- Vorherrschende Sprache
- Go
- Sterne
- 3k
- Forks
- 202
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus gonum/plot
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 52/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 32/100
-
plot/plotter: NewHist(binPoints) panic when a small negative number is usedEvtl. vergeben @SashaMIT hat das vor 15 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Ähnliche Issues
-
documentation ready
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Needs Triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
solongate/agent-security#154 ·
Maintainer antworten meist innerhalb von 1 Tag
-
tree: RootStyle is applied twice to the root nodeEvtl. vergeben @PhotoDotPi hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
charmbracelet/lipgloss#772 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag