library(ggplot2) # Generate data N = 100 XX = rnorm(N) YY = rnorm(N) Condition = rep(c("red", "blue"), N) dd <- data.frame(x = XX, y = YY, c = Condition) # Determine extremes for equal limits on both axes extremes = max(c(abs(XX), abs(YY))) # Create the plot p <- ggplot(dd, aes(x = x, y = y, color = Condition, shape = Condition)) + geom_point(alpha = 0.6) + ggtitle("Good title") + scale_x_continuous(name = "x-axis", limits = c(-extremes, extremes)) + scale_y_continuous(name = "y-axis", limits = c(-extremes, extremes)) + coord_fixed(ratio = 1) # Ensures equal scaling for x and y axes # Save the plot with different dimensions ggsave(filename = "~/Desktop/plotsize/plot1.png", plot = p, width = 6, height = 5) ggsave(filename = "~/Desktop/plotsize/plot2.png", plot = p, width = 4, height = 5 / 2)