[R] customise tick marks

roslinazairimah zakaria ro@lin@ump @ending from gm@il@com
Wed Sep 12 08:20:40 CEST 2018


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 using ump.edu.my <roslinazairimah using ump.edu.my>;
roslinaump using gmail.com <roslinaump using gmail.com>*
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

	[[alternative HTML version deleted]]



More information about the R-help mailing list