Formatting minor y breaks in ggplot

I have the below chart: library(ggplot2) width = as.numeric(dff$time_terminal[1]-dff$time_terminal[2])*22.5 ggplot(data =dff, aes(x = time_terminal)) + geom_rect(aes(xmin = time_terminal – width, xmax = time_terminal + width, ymin = pmin(open.ha, close.ha), ymax = pmax(open.ha, close.ha), fill = dir)) + geom_linerange(aes(ymin=low, ymax=high)) + geom_point(aes(y = close), size = 1)+ labs(title = paste(min(df$time_terminal), max(df$time_terminal)), y = "Close", x =… Read More Formatting minor y breaks in ggplot

r ggplot not recognizing date format

I have the following chart. p1 <- ggplot(data = mydat, aes(x = time))+ geom_line(aes(y = sumabsdiff, colour = ‘sumabsdiff’))+ geom_line(aes(y = windsize, col=’windsize’))+ scale_x_time(breaks = scales::date_breaks(‘1 sec’))+ #(’15 secs’))+ scale_color_manual(values=c(‘sumabsdiff’ = ‘black’, "windsize" = "red"))+ theme(legend.position = "top") As you can see, the date is all messed up even though time seems perfectly fine to… Read More r ggplot not recognizing date format

Remove points and dashed line from respective legend item symbols and add space between them

Based on the data and code below how can I remove geom_points from Average Precipitation and Average Mean Temperature showing in the legend and the dashed line from the Precipitation symbol, and add white space between these legend symbols? And for some reason these legend items symbols show the dashed line as a dashed +.… Read More Remove points and dashed line from respective legend item symbols and add space between them

Display the basic summary statistics next to the ggplot2 boxplot

Is it possible to display the summary statistics next to the boxplot like: throu<-structure(list(case_id = c("WC4132791", "WC4130879", "WC4128064", "WC4121569", "WC4121568", "WC4130112", "WC4131829", "WC4130841", "WC4130306", "WC4130417", "WC4124741", "WC4130114", "WC4131990", "WC4121986", "WC4128062", "WC4122478", "WC4130337", "WC4125822", "WC4127231", "WC4124761", "WC4129398", "WC4131040", "WC4123072", "WC4131822", "WC4120712", "WC4121978", "WC4130110", "WC4123522", "WC4130307", "WC4122643", "WC4130383", "WC4122248", "WC4122299", "WC4122727", "WC4126769", "WC4131186", "WC4125978", "WC4129089", "WC4121339", "WC4126469",… Read More Display the basic summary statistics next to the ggplot2 boxplot

Axis title won't rotate when y-axis is on the right

I am trying to generate a plot with y-axis on the right and I would like to rotate the y-axis title to be horizontal. Here’s some sample code : ggplot() + geom_function(fun = ~ -.x) + scale_x_continuous(limits = c(-0.27,0),name = "example")+ scale_y_continuous(position = "right",limits = c(0,0.27),name = "test")+ theme_classic()+ theme(axis.title.y = element_text(angle = 0, hjust… Read More Axis title won't rotate when y-axis is on the right

Grouping bars in a plot by column value using ggplot2 in R

I have count data of invertebrates along a transect line. The data includes 3 columns- one column for the date the data was collected on, one for the transect identification number, and one for the species observed. structure(list(Date = c("8/22/2022", "8/22/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/23/2022", "8/18/2022",… Read More Grouping bars in a plot by column value using ggplot2 in R