How to change the labels of the values on the x-axis of a scatterPlot of the openair package?
And how to change the scale on this x-axis?
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 -
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))
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)
.