Comments (2)
You need to add a group aesthetic
library(ggiraph)
library(ggplot2)
data <- structure(list(
variable_label = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L), levels = c("Bejing", "Brussels", "Budapest"), class = c("ordered", "factor")),
category = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), levels = c("Not at all", "A bit", "A lot"), class = "factor"),
count = c(55L, 37L, 8L, 40L, 48L, 12L, 45L, 42L, 13L),
proportion = c(0.55, 0.37, 0.08, 0.4, 0.48, 0.12, 0.45, 0.42, 0.13),
data_label = c("0.55", "0.37", "0.08", "0.40", "0.48", "0.12", "0.45", "0.42", "0.13"),
Tooltip = c("Not at all: 55", "A bit: 37", "A lot: 8", "Not at all: 40", "A bit: 48", "A lot: 12", "Not at all: 45", "A bit: 42", "A lot: 13")
), class = "data.frame", row.names = c(NA, -9L))
zz <- ggplot(data, aes(
y = proportion,
x = variable_label,
fill = category,
label = data_label,
group = category
),
cumulative = TRUE
) +
geom_col_interactive(
mapping = aes(tooltip = Tooltip), # Messes up category order
position = position_stack()
) +
geom_text(position = ggplot2::position_stack(vjust = .5))
from ggiraph.
Oh, whoops, this will be an easy workaround that I should have tried. Still found it a bit surprising as specifying group =
is not necessary with regular ggplot2. But as long as it works I am happy! Thanks.
from ggiraph.
Related Issues (20)
- Feature request-hover text autocoloring HOT 1
- Can't load ggiraph with dev ggplot2 HOT 3
- geom_ribbon_interactive hover not selecting both ymin and ymax
- Custom tooltip label for `zoom_off` does not appear in plot toolbar HOT 1
- Feature request-Add a button to draw geometries HOT 1
- legend not plotting when using `scale_linetype_manual()` and `scale_colour_manual()` HOT 4
- Enable ability to change SVG role for accessibility HOT 1
- Output preprocessor for R Shiny testing HOT 2
- Respect RNG seed for SVG IDs HOT 3
- girafe and piping HOT 2
- Transparent background HOT 2
- ggiraph fails to install error code 1 HOT 1
- Could geom_*_interactive support trailing comma's? HOT 1
- Specifying svg_width/height changes legend pattern HOT 1
- geom_col_interactive() ignoring specified order of stacked bars (duplicate of #265) HOT 2
- y-axis alignment issue when changing fonts HOT 2
- geom_hline_interactive with coord_polar not working HOT 4
- Toolbar elements initial state HOT 2
- ggiraph is not working with R 4.4.0 for Windows HOT 7
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 ggiraph.