[R] customise tick marks

roslinazairimah zakaria
Wed, 12 Sep 2018 06:20:40 -0000

Dear r-users,

I want to draw dotplot for mtcars data according to cyl. There are three
types of cylinder 4,6,8. However when we draw it does not use 4,6,8 instead
label it as 1,2,3.

I have this code and would like to customise the tick mark according to cyl
groups:


dotplot(cyl ~ mpg, data = mtcars, groups = cyl, cex=1.2,axes=FALSE,
  main="Gas Milage for Car Models",  xlab="Miles Per
Gallon")
ticks = c(1,2,3)
axis(2, at = ticks, labels=c(4,6,8))

I got this message:

axis(2, at = ticks, labels=c(4,6,8))
Error in axis(2, at = ticks, labels = c(4, 6, 8)) :
  plot.new has not been called yet

Thank you so much for any help given.
--
*Roslinazairimah Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairimah at ump.edu.my <roslinazairimah at ump.edu.my>;
roslinaump at gmail.com <roslinaump at gmail.com>*
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

	[[alternative HTML version deleted]]