如何在R的露天包装的scatterPlot中更改比例和标签 [英] How change the scale and labels in scatterPlot of the openair package of R

查看:77
本文介绍了如何在R的露天包装的scatterPlot中更改比例和标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改露天包装的scatterPlot的x轴上的值的标签?

How to change the labels of the values on the x-axis of a scatterPlot of the openair package?

以及如何在x轴上更改比例?

And how to change the scale on this x-axis?

推荐答案

我不知道如何在openair的scatterPlot函数中完成此操作,因为这样做的典型方法(下面概述)在测试中不起作用.但是,例如,如果您是在进行简单线性回归的散点图之后,则可以始终使用plot()函数,并应用以下修改-

I am not aware of how this can be done in openair's scatterPlot function, as the typical way of doing so (outlined below) does not work on testing. However, if you are after a scatter plot for simple linear regression, for example, you can always use the plot() function, and apply the following modifications -

使用R中的plot()函数,可以使用xaxt= "n"参数和axis()函数来创建自己的x轴标签.可以使用xlim=c(min, max)参数更改范围.例如-

With the plot() function in R, this can be done using the xaxt= "n" argument and axis() function to create your own x-axis labels. The range can be changed with the xlim=c(min, max) argument. For example -

plot(x_vector, y_vector, xaxt = "n", xlim=c(0.02, 0.09))
axis(1, at = c(0.02, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09),
        lab = expression (1, 2, 3, 4, 5, 6, 7, 8, 9))

at = c(values)是默认x标签值的列表,lab=expression(values)是您为at =c(values)下列出的每个默认值提供值的位置.

The at = c(values) is the list of the default x-label values, The lab=expression(values) is where you give your value for each of the default values listed under at =c(values).

这篇关于如何在R的露天包装的scatterPlot中更改比例和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆