1

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?

Dani Depi
  • 313
  • 3
  • 16

1 Answers1

1

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).

R Ramsay
  • 130
  • 7
  • @Ramsay I know this property of plot, using `xaxt= "n"` and `axis()`, and I also tried these on openair's scatterPlot function, and also did not work. I need openair's scatterPlot function because of its `hexbin`, which is more beautiful. – Dani Depi Aug 30 '17 at 16:57