0

I have my R data in x, y, and z format, x and y being vectors of length 10 and 19 respectively and z being a matrix of 10x19 integers. I have the following code that prints my 3D surface:

height <- (z - range(z)[1]) / diff(range(z))
r.prop <- height
g.prop <- 0
b.prop <- 1 - height
color  <- rgb(r.prop, g.prop, b.prop, maxColorValue=1)

persp3d(x, y, z, theta=50, phi=25, expand=0.75, col=color, ticktype="detailed",
    xlab="filesize [kb]", ylab="record size [kb]", zlab="speed [b/s]", 
    axes=TRUE)

My problem is that the y axis contains powers of 2 (4, 8, 16, 32, 64, ..., 2048,..), which squeezes most of my data points into the low-range part of the plot. What I want is an even distribution of the data points, i.e. between point 4 and 8 should be the same space as between 1024 and 2048 just like it is in the Excel spreadsheet surface plot.

Can you tell me which command or parameter would make that happen with persp3d?

Thanks a bunch! Loddi

Addition: After changing the the axes to log2, or just doing a c(1:length(x)) and c(1:length(y)) instead of the actual axis values, it looks better but now has these weird jigsaw shape that is not at all represented in my data. Do you guys have a clue what is going on here? see picture here https://i.stack.imgur.com/WBI3r.png

Loddi
  • 65
  • 7
  • Welcome to Stack Overflow! Please check this [link](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). A good reproducible example will help others to tackle your question lot more easily. – CHP Nov 14 '13 at 03:07

1 Answers1

0

Try log2(y) instead of y

persp3d(x, log2(y), z, theta=50, phi=25, expand=0.75, col=color, ticktype="detailed",
    xlab="filesize [kb]", ylab="record size [kb]", zlab="speed [b/s]", axes=FALSE, 
    normal_x=x, normal_y=y, normal_z=z)
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
CHP
  • 16,981
  • 4
  • 38
  • 57
  • great thanks that actually got me the idea of just changing the the values in x and y to linear ones and adding custom axis titles instead. However now I am seeing this jigsaw pattern that is not in my actual data (see posted picture in my updated main question text). Any Idea why that is? – Loddi Nov 14 '13 at 07:35