Replace X axis with eigenvalues

I have a question regarding the plot () command.

Is there a way to completely eliminate the X axis and replace it with eigenvalues? I know that I can get rid of the axis by doing

plot(x,y, xaxt = 'n') 

and then add the c axis

 axis(side = 1 etc.) 

However, when I add the axis, obviously it still refers to the data constructed as "x". I would only like to build the β€œy” values ​​and add the x axis to my own, in the sense of just β€œdrawing” the x axis with its specified values. Is there any way to do this?

This question is based on the fact that my two data frames differ in length, and therefore I cannot outline them.

+61
r plot
Mar 03 2018-11-11T00:
source share
2 answers

Not sure what that means, but you can do it:

 plot(1:10, xaxt = "n", xlab='Some Letters') axis(1, at=1:10, labels=letters[1:10]) 

which then gives you a graph:

enter image description here

+117
Mar 03 2018-11-11T00:
source share

Yo can also set labels = FALSE inside axis(...) and print the labels in a separate command using Text. With this option you can rotate text with text if necessary

 lablist<-as.vector(c(1:10)) axis(1, at=seq(1, 10, by=1), labels = FALSE) text(seq(1, 10, by=1), par("usr")[3] - 0.2, labels = lablist, srt = 45, pos = 1, xpd = TRUE) 

Detailed explanation here

Tagged Image

+7
Jan 07 '16 at 19:54
source share



All Articles