my geom_boxplot do not have box

When I run code, there isn't a box appear, only have point.
How can I fixed it?

library(ggplot2)
as_tibble(new_data)
str(new_data)
ggplot(new_data, aes(x = "", y = ride_length)) + geom_boxplot()

'data.frame': 5828127 obs. of 8 variables:
ride_id : chr "620BC6107255BF4C" "4471C70731AB2E45" "26CA69D43D15EE14" "362947F0437E1514" ... rideable_type : chr "electric_bike" "electric_bike" "electric_bike" "electric_bike" ...
member_casual : chr "member" "member" "member" "member" ... date : Date, format: "2021-10-22" ...
month : num 10 10 10 10 10 10 10 10 10 10 ... day_of_week_name: Ord.factor w/ 7 levels "Monday"<"Tuesday"<..: 5 4 6 6 3 4 4 3 4 3 ...
season : chr "autumn" "autumn" "autumn" "autumn" ... ride_length : num 188 97 467 75 496 861 161 501 448 509 ...

geom_boxplot() shows outliers (points outside of 1.5x IQR) as points. You do have a box, it is just that your outliers are so big and are so spread out the box has shrunk to nothing! You may have to change your y-axis scale, filter your data, or calculate boxplot parameters manually and use stat = "identity".

library(tidyverse)

dat <- tibble(x = 1:100) %>% 
  mutate(y = 10 ^ x)

# linear - can't see box!
ggplot(dat, aes(x = "", y = y)) +
  geom_boxplot()

# log scale - there it is!
ggplot(dat, aes(x = "", y = y)) +
  geom_boxplot() +
  scale_y_log10()

Created on 2022-10-27 with reprex v2.0.2

scale_y_log10()
This code is also fit to my data to present a little box.
Thank you so much for your useful help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.