0

In a simple scatterplot of two continuous variables (using ggplot) I'm trying to add a line break to the beginning of one of the axes, so that it is more clear that it does not start at 0.

To more clearly explain what I am trying to do, here is an example-plot using the mtcars dataset:

# Load packages.
library(tidyverse)
library(magrittr)

# Get data.
data <- mtcars 

# Scatterplot.
data %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point() + 
  theme_classic() +
  scale_x_continuous(limits=c(0, 6))

enter image description here

In this case, the X axis runs from 0 to 6, that's fine. But the Y axis runs from 10 to 35, and so does not start at 0 (which might be overlooked).

To make this more clear, I'd like the plot to look a little like this (made in Paint):

enter image description here

Is this possible in ggplot?

tcvdb1992
  • 393
  • 1
  • 7

0 Answers0