aliciaschep / gglabeller Goto Github PK
View Code? Open in Web Editor NEWShiny gadget for labeling points on ggplot
License: Other
Shiny gadget for labeling points on ggplot
License: Other
This is a really useful package. I was wondering if it is possible to return the row names of the selected points to throw them into another function for misc. operations?
Also, do you know if R supports the use of a lasso tool for selection?
Thanks!!
Hi, I've been using gglabeller for quite some time now and find it super helpful. However recently have been unable to use it because it throws the following error only when I try to click on a point:
Warning: Error in : Aesthetics must be either length 1 or the same as the data (32): segment.colour 189: <Anonymous>
This error occurs whether I pass the labels through the gglabeller function or in the original ggplot2 object and I believe it coincided with upgrading to ggplot2 v3.3. It also occurs if I just pass a static label (single string).
Reproducible e.g. is from your docs:
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() +
theme_classic(base_size = 18)
gglabeller_example <- gglabeller(p, aes(label = rownames(mtcars)))
R.version:
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 0.1
year 2020
month 06
day 06
svn rev 78648
language R
version.string R version 4.0.1 (2020-06-06)
nickname See Things Now
Any suggestions or thoughts? Thank you for your help!
update to use the ggrepel seed arg rather than setting seed
Hi Alicia,
Thanks for making such a great and useful package! I am trying to figure out how to modify the aesthetics of the label itself while using gglabeller (if this is pretty obvious, forgive me!). If I just use the ggrepel package to do my labelling, I can do this pretty easily using geom_text_repel, but I can't seem to figure out how to incorporate that with the utility gglabeller provides. Any insight would be helpful!
Thank you,
Sarah
On closing the app by clicking the cross it leaves the terminal in a constant state of R working at 100%.
Just stuck at the stage as if the app was still open, is there a fix or a way out of this?
Cheers
If I create a list of plots with map(), I'm unable to select points when gglabeller is called on any element of that list but the first. The GUI still pops up, and I can still use the "Label All" button, but brushing over points doesn't label them.
library(tidyverse)
library(gglabeller)
#Create some data
testdata <- tibble(sample = rep(LETTERS[1:6], each = 15),
catvar = rep(paste0("var_",letters[1:15]), times = 6),
contvar = abs(rnorm(90)))
#Split data into manageable chunks for plotting by categorical variables
testlist <- testdata %>%
mutate(catvar = as.factor(catvar),
group = as.numeric(catvar) %>%
cut(3) %>% #cut into how many pieces?
as.integer()) %>%
split(.$group) #returns a list of dataframes
testplots <- map(testlist, #for every data frame in the list...
~ggplot(., aes(x = catvar, y = contvar, label = sample)) +
geom_point()
)
gglabeller(testplots[[1]])
gglabeller(testplots[[2]])
Alicia,
labeller is a much needed R pkg!.
But when I try the GIT mtcars example,
I get an error.
library(gglabeller) # version 0.1.0 installed from GIT, as instructed
library(ggplot2) # version 2.2.1.9000
library(ggrepel) # version 0,7.0
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + theme_classic(base_size = 18)
gglabeller_example <- gglabeller(p, aes(label = rownames(mtcars)))
Error in gglabeller(p, aes(label = rownames(mtcars))) : labels don't match number of rows of data
Running the latest Rstudio and R versions (Linux).
Thanks for your guidance
on what is missing?.
Thank you!
SFd99
San Francisco
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.