在scatterplot3d中旋转y轴标签(调整到轴的角度)(Rotate y

编程入门 行业动态 更新时间:2024-10-26 03:37:03
在scatterplot3d中旋转y轴标签(调整到轴的角度)(Rotate y-axis label in scatterplot3d (adjust to angle of axis))

我使用scatterplot3d用R绘制3D scatterplot3d轴标签的方向困扰我,因为它是垂直的而不是与y轴平行。 有没有办法旋转标签并调整其角度? 不幸的是,我没有在文档中找到任何东西。

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.

最满意答案

如果您不必绘制多个绘图并且愿意手动调整值,则可以在进行三维散射时传递ylab = "" ,然后使用适当的srt值添加text 。 srt允许您以所需的角度旋转文本。 请注意,添加文本时的x和y与3d散射的x和y不同。

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

在此处输入图像描述

使用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)

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)

更多推荐

本文发布于:2023-08-02 18:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1380706.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:角度   标签   scatterplot3d   Rotate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!