stefanbschneider
stefanbschneider

Reputation: 6076

Rotate y-axis label in scatterplot3d (adjust to angle of axis)

I use scatterplot3d to plot 3D with R. The orientation of the y-axis label bothers me because it is vertical and not parallel to the y-axis. Is there a way to rotate the label and adjust its angle? Unfortunately, I didn't finde anything in the documentation.

Upvotes: 1

Views: 4949

Answers (1)

d.b
d.b

Reputation: 32538

If you don't have to draw many plots and are willing to adjust values manually, you can pass ylab = "" when making the 3d scatter and then add text later on with appropriate srt value. srt allows you to rotate text at desired angle. Note that x and y when adding text is different from x and y of 3d scatter.

set.seed(42)
scatterplot3d(rnorm(20), rnorm(20), rnorm(20), ylab = "")
text(x = 5, y = -2.5, "Y-axis", srt = 45)

enter image description here

Using scale.y

set.seed(42)
scatterplot3d(rnorm(20), rnorm(20), rnorm(20), ylab = "", scale.y = 2)
text(x = 6.5, y = -1.5, "Somewhat longer Y-axis", srt = 45)

Upvotes: 3

Related Questions