Questions tagged [beeswarm]
29 questions
0
votes
1 answer
How do I create a plot that is half box plot and half beeswarm in R?
I'm using this link currently to create a right-sided beeswarm plot: https://r-charts.com/distribution/beeswarm/. I want to add a box plot to the left side of the beeswarm plot to create a plot that looks like this Nature one.
Does anyone know how…

divsan
- 1
- 1
0
votes
0 answers
Beeswarm: operands could not be broadcast together with shapes (10,) (11,)
I would like to create beeswarm plot, but I have always the same error. Below I put the script. There is some solution?
tokenizer = AutoTokenizer.from_pretrained('m-polignano-uniba/bert_uncased_L-12_H-768_A-12_italian_alb3rt0',…

Rachele Franceschini
- 127
- 8
0
votes
0 answers
DeepSHAP beeswarm plot only shows blue dots and does not have a color gradient to show feature values
I tried running an example on SHAP Deep Explainer from this link using this Titanic dataset. This is the code from the example:
# import package
import shap
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from…

natnicha teja
- 11
- 2
0
votes
1 answer
Beeswarm plot in R: weird gaps?
I've made a beeswarm plot in R by basically looping through groups in my data and creating a beeswarm for each group and combining into one plot:
#Build color field
color.By.Category <- function(x) {
if (x == "Polydrug") {
return("red")
}…

DiamondJoe12
- 1,879
- 7
- 33
- 81
0
votes
1 answer
Custom features in beeswarm plot of shap
I have a causal inference model with
featurizer=PolynomialFeatures(degree=3)
which includes a degree 3 polynomial in X variable. I get the plot for interpretability too with:
shap.plots.beeswarm(shap_values['Y0']['T0'])
but the plot shows me the…

Juan David Gutiérrez
- 51
- 1
0
votes
0 answers
geom_beeswarm with half plot and not symmetry
I am using geom_beeswarm to test the distribution of data in my dataset. In my toy example here, this is my code to do that.
library(survival)
library(ggplot2)
library(ggbeeswarm)
data("pbc")
head(pbc)
ggplot(pbc, aes(x=trt, y= age, color = trt))…

Science11
- 788
- 1
- 8
- 24
0
votes
0 answers
Beeswarm from Reordering Categorical Variables
I am trying to make beeswarm and boxplot graphs of my data, but beeswarm is putting the categorical variables in alphabetical order when I would like them in order of treatment.
iMono <- beeswarm(iMono ~ Treatment, data=MyeloidLiver, ylab = "%…
0
votes
1 answer
Save a legend to a Boxplot with ggsave
I'm pretty new to R and have a question regarding ggsave. I use the following code to first create a box plot, then add a bee swarm plot on top of it and save it with ggsave. Now, I would like to add a p-value on the bottom of the plot. However, I…

RTobey
- 1
0
votes
1 answer
Assign colours to quantiles in a beeswarm plot within a for loop
My goal is to assign custom colours to the quantiles (first 25% of the data, second 25%, et cetera) for multiple beeswarm plots within a for loop. I have added my code and an image of a beeswarm plot. The grey coloured dots (see plot) need to be…

YasinTuncbilek
- 5
- 3
0
votes
2 answers
R: plot line segment behind points in R
I'm using the 'beeswarm' package and want to plot an abline behind my points. The code below will plot the line on top of my points.
library(beeswarm)
testdf<-data.frame(a=c(1,1,1,2,2,2,3,3,3),b=c(1,2,3,1,4,6,1,3,4))
beeswarm(b ~…

person
- 96
- 12
0
votes
1 answer
Change color for one element in a beeswarm plot in R
Starting from a .csv I'd like to highlight a single point in a beeswarm plot.
library("beeswarm")
#carico dati
library(readr)
lavororadar <- read_delim("lavororadar.csv",
";", escape_double = FALSE, trim_ws =…

Martino Vignali
- 3
- 4
0
votes
2 answers
Removing axes in beeswarm plot
I have a following "beeswarm" (a single-dimensional scatterplot)
library(beeswarm)
data(breast)
beeswarm(breast$time_survival,horizontal=TRUE)
Here is the resulting plot:
How can I get rid of the axes and the box around the plot, so that I can…

Oposum
- 1,155
- 3
- 22
- 38
0
votes
1 answer
Beeswarm with logarithmic X axis
I am trying to plot a "beeswarm" which is essentially a single-dimensional scatterplot
library(beeswarm)
data(breast)
beeswarm(breast$time_survival,horizontal=TRUE)
What I want to achieve is logarithmic transformation of the X axis.
Obviously, I…

Oposum
- 1,155
- 3
- 22
- 38
-1
votes
1 answer
Why are the SHAP values for some features in my model always negative (or positive)?
I am explaining a HistGradientBoostingRegressor from sci-kit learn. I use the TreeExplainer from the shap package to get the SHAP values. My model has 48 features, some of which are strongly correlated. The beeswarm summary plot of the model looks…

Mpala
- 31
- 4