New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ColorMap types and legends #322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review.
|
||
// ColorMapLegend is a plot.Plotter that draws a color bar legend for a ColorMap. | ||
type ColorMapLegend struct { | ||
// Vertical determines wether the legend will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether
// The default is false (horizontal). | ||
Vertical bool | ||
|
||
// NColors specifies the number of colors to be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/NColors/Colors/g
|
||
// StringMap fulfils the ColorMapString interface, mapping integer | ||
// categories to colors. | ||
type StringMap struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not be a map?
// If scalar is outside of the allowed range, an error is returned. | ||
type ColorMap interface { | ||
// At returns the color associated with the value scalar. | ||
At(scalar float64) (color.Color, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/scalar/v/ or even s/scalar// (updating the comment).
|
||
// IntMap fulfils the ColorMapInt interface, mapping integer | ||
// categories to colors. | ||
type IntMap struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this not be a map?
// If there is no mapped color for the given category, an error is returned. | ||
type ColorMapInt interface { | ||
// At returns the color associated with category cat. | ||
At(cat int) (color.Color, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/At/Color/g ?
s/cat/int/g or s/cat/v/g
What happened here? |
This has become a bit of a mess. It depends on the changes in #321, but in response to comments over there I have moved some of the code from this PR over there. Once that one is merged I will fix this one. |
4f4fdeb
to
235bd2a
Compare
This pull request was based on a non-master branch, which has caused some trouble. I will start a new one relative to master. |
This is related to issues #304, #133, and #17