How to add exponent value to x title

Having issue adding space, I am using the following to name my x and y title. labs(y = "% biomass", x = expression(paste("Mulch amount", tha^{-1}))) It’s resulting in no space between mulch amount and tha (making it Mulchamounttha(-1). Does anyone know how to add space in between using the same code style? >Solution : From… Read More How to add exponent value to x title

R object not found when using scale_x_discrete or scale_x_continuous

hour_mark avg_intensity <int> <dbl> 0 2.1295503 1 1.4190782 2 1.0439443 3 0.4437299 4 0.6330472 5 4.9506438 6 7.7712137 7 10.7336198 8 14.6680988 9 15.3877551 10 17.6437029 11 16.9212513 12 19.8470716 13 18.7752443 14 18.8686211 15 15.5846995 16 17.7166483 17 21.6556291 18 21.9216336 19 21.3852097 20 14.3399558 21 12.0729282 22 9.0630531 23 4.9966777 ggplot(data=avg_int_hourly, aes(x=hour_mark, y=avg_intensity,group=1))+… Read More R object not found when using scale_x_discrete or scale_x_continuous

Order the stacked barplot by proportion or percent in R

I can order my plot based on count but not by proportion. I want to bars on x-axis to be arranged by proportion of "c". Here is my code long<- data.frame( Name = c("abc","abc","abc","gif","gif","gif","xyz","xyz","xyz"), variable = c("a","b","c","a","b","c","c","b","a"), value = c(4,6,NA,2,8,1,6,NA,NA)) long_totals <- long %>% group_by(Name) %>% summarise(Total = sum(value, na.rm = T)) p<-long %>% mutate(variable… Read More Order the stacked barplot by proportion or percent in R

Adding a suffix that includes superscript text to axis text in ggplot

I want to have my x-axis show the scale with an added "m2" at the end of each axis text using the scales::label_number() function. Reproducible code: tibble(x = 1:10, y = 1:10) |> ggplot(aes(x, y)) + scale_x_continuous(label = scales::label_number(suffix = "m^2")) which gives me "5m^2" (for example) on the x-axis, whereas I want it to… Read More Adding a suffix that includes superscript text to axis text in ggplot