How to Add Axis Tick Marks to Visualizations in ggplot (R programming)

Tick marks allow you to view your data differences more easily. Here’s how to do it in R programming using ggplot.

Pierre DeBois
4 min readJul 1, 2024

Once in a while when you put together a data visualization with a lot of data points you want to make sure that you have the right number of ticks available to help people understand where those dots are relative to each other in the graph.

For ggplot in R programming there’s a quick way of adding axis minor tick marks in the syntax so that you are able to display differences in your data more clearly.

For these examples, I am using the GT cars dataset from the GT Library, focusing mainly on the miles per gallon metrics for city and highway and for comparing horsepower to horsepower output RPMs.

To add the ticks you need to include the guides() function and then select its guide_axis parameter. The guide axis parameter has allows a Boolean selection called minor ticks as a Boolean true or false.

The graph below shows the horsepower vs. RPMs without the tick marks.

--

--

Pierre DeBois

#analytics |#datascience |#JS |#rstats |#marketing services for #smallbiz | #retail | #nonprofits Contrib @CMSWire @smallbiztrends #blackbusiness #BLM