Graphical parameters in ggplot2: How to change axis/tick thickness

I just started using 'ggplot2', and am running into some problems with the graphical usability.

I wanted to do a simple regression biplot. However, I am not quite convinced by the themes offered by 'ggplot2' and 'ggthemes'.

My code thus far is as follows:

 ggplot(data, aes(APE.15N, APE.13C)) + geom_point(size=3) + geom_smooth(method="lm", se=F, col="black") + theme_light(base_size = 20) + annotate("text", x=.9, y=1.35, label="R²=0.3192, p<0.001", size=6.5) + coord_cartesian(xlim = c(.25, 1.1), ylim = c(1.05, 2.55)) + ylab(expression(paste('APE '^{13}, "C", sep = ""))) + xlab(expression(paste('APE '^{15}, "N", sep = ""))) 

...which gives me the following plot:

ouput from R with ggplot2

Now, I would like to increase the axis-line thickness as well as the tick thickness to at least 2 points, add minor ticks, get rid of the background grid, and change the axis colour to black.

I just can't figure out how...

I would imagine the result as in the following graph:

example graph

Thank you, your help is very much appreciated

2

1 Answer

To increase the axis-line thickness and change the color to black:axis.line = element_line(colour = 'black', size = 2)

To increase the tick thickness:axis.ticks = element_line(colour = "black", size = 2)

To add minor ticks: Minor ticks are not currently an option of ggplot2. There are many other stackoverflow questions about minor ticks that I would suggest looking at. You can try adding minor_breaks in scale_x_continuous, but that would require a knowing the actual minor ticks you want.

To remove the background grid:panel.grid.major = element_blank(), panel.grid.minor = element_blank()

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like