Scaling X Axis Values

by Mike Weltevrede   Last Updated September 15, 2018 10:26 AM

I am trying to plot the function described below. However, when I do plot it, the x-axis shows 0 up to 1000, probably due to my definition of x0, instead of 0 up to 10. However, if I just use 1:10 as my x-values, the plot is not smooth at all. My question is: how do I set the x-axis to give me the real values that correspond to the function at that point?

PS: I have seen solutions where people replace the x-axis fully with their own values, but I am looking for a method that just uses the actual values of x.

eq <- function(x){
  4*x^3 - 72*x^2 + 288*x
}

x0 <- seq(1, 10, by = 0.01)

plot(eq(x0),type='l',main="Plot of 4*x^3 - 72*x^2 + 288*x", xlab = "x", ylab = "4*x^3 - 72*x^2 + 288*x")
Tags : r function plot


Related Questions


Customizing appearance of DCA function in R

Updated November 22, 2017 14:26 PM

Creating multiple plots from a data frame in R

Updated February 15, 2018 06:26 AM


Why my for loop for my curve returns `Inf` in R?

Updated June 09, 2017 05:26 AM

Repeat n times a subset and plot in R

Updated July 26, 2017 03:26 AM