I'm trying to plot negative and positive values on x-axis and y-axis to see the distribution. However, ggplot2
plots all the values on side of the axis, even the negative ones. I want to make something like this but with dots on it denoting distribution based on my data: How should I do this?
Here's a sample dataset:
df <- structure(list(States = structure(c(1L, 3L, 2L, 4L),
.Label = c("AP", "Gujarat", "Punjab", "Rajasthan"),
class = "factor"),
a = c(20, 45, -15, 10),
b = c(14, -67, 45, -5)),
class = "data.frame",
row.names = c(NA, -4L))
Here's my code:
library(tidyverse)
library(ggplot2)
df1 <- df
p <- ggplot(df1, aes(a, b), scale="globalminmax") +
geom_point() +
theme_minimal()
p