Ricky Mutschlechner
Ricky Mutschlechner

Reputation: 4409

Displaying axis values in hexadecimal in R

How do I go about displaying an axis in hexadecimal in R, in a scatter plot? The data I am reading in from the CSV is already in hexadecimal.

I'm trying to display memory accesses, and here is my current code:

vec <- read.csv("http://example.com/example.csv")
y <- vec$high
x <- vec$low

plot(x, y, main="Memory Accesses", 
     xlab="Low 32-bits ", ylab="High 32-bits ", pch=19, cex=0.1)

Which displays:

scatter plot for memory accesses

Upvotes: 1

Views: 172

Answers (1)

user3710546
user3710546

Reputation:

As pointed out by rawr while I was writing this answer (note that 0:6 * 10000 is nicer that what I wrote, but don't want to steal it):

plot(x, y, main="Memory Accesses", xaxt = "n", yaxt = "n",
     xlab="Low 32-bits ", ylab="High 32-bits ", pch=19, cex=0.1)
axis(1, seq(0,60000,10000), paste0("0x",as.hexmode(seq(0,60000,10000))))
axis(2, seq(0,60000,10000), paste0("0x",as.hexmode(seq(0,60000,10000))))

enter image description here

Upvotes: 2

Related Questions