Open sarahtanja opened 6 months ago
library(ggplot2)
data <- data.frame( x = 1:10, y = runif(10, min = 0, max = 1e-5) )
p <- ggplot(data, aes(x = x, y = y)) + geom_point() + labs( y = expression("Rate (mg/min) x"~10^-5), x = "Time (min)", title = "Rate over Time" ) + scale_y_continuous( labels = function(x) x / 1e-5 # Transform the y-axis labels )
print(p)
`# Load ggplot2 library(ggplot2)
Create a sample plot
p <- ggplot(mpg, aes(x = displ, y = hwy, color = class)) + geom_point() + labs( title = "Fuel Efficiency", x = "Engine Displacement (L)", y = "Highway Miles per Gallon", color = "Car Class" )
Adjust text sizes using theme()
p + theme( plot.title = element_text(size = 20, face = "bold"), # Title text size axis.title.x = element_text(size = 16), # X-axis title text size axis.title.y = element_text(size = 16), # Y-axis title text size axis.text.x = element_text(size = 14), # X-axis text size axis.text.y = element_text(size = 14), # Y-axis text size legend.title = element_text(size = 16), # Legend title text size legend.text = element_text(size = 14) # Legend text size ) `