Comments (1)
This has been on my mind as well to make the interface between scales and palettes somewhat smoother.
Your first example can be replaced with discrete_scale("colour", palette = scales::pal_hue())
, but this is not so much the case for the continuous examples.
For this to happen, I think {scales} needs to start describing palette functions more so that some properties are easily queried.
Useful properties to know about palettes are:
- Is it continuous, i.e. does it accept values in the (0, 1) range.
- Is it discrete, i.e. does it accept
n
values. - If discrete, what is the maximum
n
it will accept? - Do they have built-in
NA
handlers (e.g. viascales::colour_ramp()
)?
If we know this, we can automatically expand discrete palettes to continuous ones by using e.g. colour_ramp(discrete_pal()(n_max))
, or discretise continuous palettes by using continuous_pal()(seq(0, 1, length.out = n)
.
from ggplot2.
Related Issues (20)
- Feature request: reassemble the ggplot object after `ggplot_build` HOT 1
- partial match (vp$just --> 'justification') HOT 2
- Could colour bar guide ticks be more readable? HOT 3
- Release ggplot2 3.5.1
- custom guide with `theme_void()` will throw a warning message HOT 1
- VSCode and ggplot (randomly) throw error "Error in UseMethod("depth")". HOT 7
- Feature request: flexible parametrisation of rectangles
- AsIs sometimes not preserved when computing geom parameters HOT 4
- Cryptic error when mis-specifying linetype HOT 6
- Version 3.5.0 or 3.5.1 cannot render a plot made with 3.4.4 HOT 2
- Standardising calls to `gpar()`
- Fill and color guides for factor with `drop=FALSE` don't show color. HOT 7
- `guide_coloursteps(show.limits = T)` produces strange lower limit HOT 1
- Warnings due to partial matching HOT 2
- Reproducible example for `position_jitter()` not working HOT 1
- geom_sf_label() returns an error HOT 3
- date_breaks and date_breaks minor don't check argument type HOT 2
- `scale_*_*` `labels` argument often doesn't work as expected with a function HOT 8
- geom_histogram produces wrong number of bins in special cases HOT 2
- x/ylim Arguments in coord_fixed Donβt Seem to Be Applied to Contours: HOT 1
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 ggplot2.