Comments (12)
It's not a problem; these discussions are important
from colourvalues.
What about a na.alpha
to e.g. set all NAs as transparent?
from colourvalues.
<sorry - misread your request>
yes - good idea.
from colourvalues.
@tim-salabim can I get your thoughts on this scenario:
Given this function call
colour_values(1:5, alpha = 1:5)
should the alpha
values be
- left as-is
1:5
(which, when converted to RRGGBBAA will be in the region of"00"
), or - assumed to be a variable which needs to be scaled to
1:5 / 5 * 255
(so when converted will be"00","3F","7F","BF","FF"
?
from colourvalues.
I'd say 2. If you're scaling the values you should also scale the alpha vector.
But I'd also say alpha should be within [0,1].
Also, would someone actually want to specify a vector of alpha? The most common scenarios in my opinion are:
- a constant alpha over all values
- a special alpha for special values (i.e. NAs)
- mapping of alpha to a (second) variable (in which case the UI usually accepts the name of a df column).
For 3. it should then be scaled to the same as the values vector.
from colourvalues.
I'm inclined to agree, and I think this point is key
mapping of alpha to a (second) variable (in which case the UI usually accepts the name of a df column).
With regards to
But I'd also say alpha should be within [0,1].
If we're scaling a column/vector of data then I don't think it matters the range of the values, as they have to be in [0,255] to be converted to #RRGGBBAA
from colourvalues.
If we're scaling a column/vector of data then I don't think it matters the range of the values, as they have to be in [0,255] to be converted to #RRGGBBAA
Agreed!
from colourvalues.
na.alpha
as 0
or 255
by default?
from colourvalues.
although, it can be specified through na_colour
colour_values(c(1,2,NA,4,5), na_colour = "#80808000")
colour_values(c(1,2,NA,4,5), na_colour = "#808080FF")
colour_values(c(1,2,NA,4,5), na_colour = "#80808080")
from colourvalues.
I'd use the same default as alpha
from colourvalues.
Do you think a separate na.alpha
is needed given it can be specified in na_colour
?
from colourvalues.
It depends, for leaflet e.g. the 8-digit hex notation was not respected (i.e. nothing was shown if in 8-digit hex) in some cases with the earlier (pre leafletjs 1.x). I am not sure how well 8-digit hex is supported in general (i.e. beyond web).
My approach in such cases is usually to not overload the api but wait and see if there is a need, so I would not implement it for now and highlight how to set it via na_colour
.
Sorry for causing the stir and then recommend to not implement it... I had forgotten why we implemented a specific na.alpha
in mapview.
from colourvalues.
Related Issues (20)
- extra control for breaks? - as in image() HOT 5
- get_palette() - return hex HOT 3
- IntegerVector vs NumericVector
- color_values() modifying global environment? HOT 3
- update to cardinal_cubic_b_spline.hpp
- normalise colours
- remove Boost HOT 2
- size_t -> R_xlen_t
- interleaved RGBA vector
- remove local interpolation .hpp file
- support interleave
- List input - n_summaries
- include_alpha = FALSE still returns alpha for NA values HOT 4
- validate na_colour hex input
- interleaved - matrix palettes HOT 1
- ASAN memory leak HOT 2
- Issue generating colors for some palettes HOT 5
- integer64 support
- templates
- Compatibility with older versions of boost HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colourvalues.