Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - Removing tick mark without removing label

Tags:

plot

r

I would like to remove the tick marks from a plot in R, but not the text associated with the individual tick marks. How do I do that?

My code is the following:

boxplot(boxDat ~ class, ylab = "Predictive Scoring", names = c("ANN", "Random\nForest", "Logistic\nRegression"), cex.axis=1, xaxt='n')
like image 294
pir Avatar asked Jun 23 '14 21:06

pir


People also ask

How do I remove tick marks in R?

Set xaxt = "n" and yaxt = "n" to remove the tick labels of the plot and add the new labels with the axis function.

How do I hide tick labels?

By default, in the Matplotlib library, plots are plotted on a white background. Therefore, setting the color of tick labels as white can make the axis tick labels hidden.

How do I remove axis labels in R?

The axes labels and ticks can be removed in ggplot using the theme() method. This method is basically used to modify the non-data components of the made plot. It gives the plot a good graphical customized look. The theme() method is used to work with the labels, ticks, and text of the plot made.


1 Answers

Maybe something like this:

boxplot(count ~ spray, data = InsectSprays, col = "lightgray",xaxt = "n")
axis(side = 1,at = 1:6,letters[1:6],tick = FALSE)
like image 181
joran Avatar answered Oct 02 '22 21:10

joran