Skip to content
Prev 201885 / 398506 Next

problem tick marker and text

Duijvesteijn, Naomi wrote:
Kudos for including reproducible code, BUT
1. do you really consider a dataframe of
    dimension ~500K by 3 to be "minimal"?
2. there are over 2000 R-packages on CRAN;
    wouldn't it be polite to say which one contains mhtplot()?
is CM used anywhere?
Here is one way, using about half the data.
I use mtext() to place the labels, since axis= seems
to be hard-coded in mhtplot.

# make a vector of labels to place between ticks
textvec <- letters[1:5]

# plot
mhtplot(test[1:2e5,],usepos=TRUE,colors=colors,gap=10000,pch=19,bg=colors)

# now figure out where to put the labels. This would be
# easy with seq() if the scale were uniform but it's not.
# So we use the locator() function.

xat <- locator()$x
xat <- round(xat)
xat
#[1]  34316  85096 132458 173961 216929

# place the labels; adjust line= if you wish
mtext(textvec, side=1, line=0, at=xat)

If I had to do this frequently, I would hack the
mhtplot() function.

  -Peter Ehlers