I'm trying to make a bar chart with a 3rd variable (which in this case is "frequency") where the 3rd variable changes the width of the bars (higher frequency = larger width). Obviously I have to figure out the sizing, but that is just aesthetics and I can figure that out later. When I use this code I keep getting the error "position_dodge requires non-overlapping x intervals" and the plot then stacks the bars instead of grouping them. Also (maybe this could help) wondering if there is a way to increase the distance between labels on the x-axis (meaning increase the distance between "Iso", "Transition", "P&R Handler", etc.) All help appreciated.
library(tidyverse)
library(ggrepel)
percentile_playtype = c(70.10, 41.20, 83.90, 0, 0, 97.30, 40, 0, 49.30, 20.10, 88.90, 91.80,
94.60, 0, 83.60, 86.90, 42, 41.10, 46.90, 0, 81.50, 84.00)
frequency = c(8.5,16.5,53.3,0,0,6,7.2,0,2.1,0.6,5.4,1.9,12.4,0,28,8.1,16,1.9,13.6,0,10.6,6.1)
v1 = sqrt(sqrt(sqrt(frequency)))/10
lowsize <- element_text(size=8)
playtype = c("Iso","Transition","P&R Handler","P&R Roll","Post Up","Spot Up",
"Handoff","Cut","Off Screen","Putbacks","Misc")
Player = rep(c("Trae Young","John Collins"), each=11)
PlayData <- data.frame(percentile_playtype,frequency,playtype,Player)
a1 <- ggplot(PlayData, aes(fill=Player, y=percentile_playtype, x=playtype)) +
geom_bar(position="dodge", stat="identity",width=v1)
a1




width =. It's possible to get the effect you are looking for, but it would be involved and difficult. My guess is that even if you could do it easily, the end result would look kinda lame. There are other, better ways to represent these numbers in a nice plot.