Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reverse axis in R

Tags:

r

reverse

I am trying to plot simple picture like this, using 3 values - xyz loaded from textfile.

enter image description here

Now I need X-axis to go from biggest numbers to lowest (now are biggest numbers on the right, I need them on the left), so that two zeros meet in the same corner. I am using this simple code:

xyz <- read.table("excel")
scatterplot3d(xyz,xlim = c(0, 100000))
xyz

I have tried "rev" with no success. Picture always looks the same. Help will be greatly appreciated.

Sample data stored in file named "excel":

8884    20964   2
8928    5   1
9033    6   2
9261    61307   1
9435    64914   3
9605    5   2
9626    7   3
9718    5   3
10117   48941   7
10599   399 9
20834   5802    10
21337   3   8
21479   556 8

I want my 0,0,0 point to be in right front down corner.

like image 727
Perlnika Avatar asked Jul 14 '26 10:07

Perlnika


1 Answers

You can choose an angle between >90 and <270

   scatterplot3d(xyz,xlim = c(0, 100000),angle=ang)

for example:

z <- seq(-10, 10, 0.01)
x <- cos(z)+1
y <- sin(z)+1
scatterplot3d(x, y, z, highlight.3d=TRUE, col.axis="blue",angle=120,
              col.grid="lightblue", main="scatterplot3d - 1", pch=20)

enter image description here

like image 130
agstudy Avatar answered Jul 17 '26 15:07

agstudy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!