-1

I have tried to plot sales order against time. graph is as follows:

image

I want to replace number of days by dates: which means replace 0 by 22/09/2016

                50 by 11/11/2016
                100 by 31/12/2016
                150 by 19/02/2017
                200 by 10/04/2017

I don't know how to proceed.

ItamarG3
  • 4,092
  • 6
  • 31
  • 44
  • There are many resources if you search for "how to plot dates r", e.g. [this one](https://stackoverflow.com/questions/4843969/plotting-time-series-with-date-labels-on-x-axis). – Roman Luštrik Jun 27 '17 at 07:44

1 Answers1

1

You will want to make use of the xts package which can handle daily values

library(xts)
v <- 0:200 # your data here
d <- seq.Date(as.Date('2016-09-22'), as.Date('2017-04-10'), length.out = 201)
plot(xts(v, order.by = as.POSIXct(d)))

Here is a great cheat sheet: https://www.datacamp.com/community/blog/r-xts-cheat-sheet#gs.1XjXRyI

Evan Friedland
  • 3,062
  • 1
  • 11
  • 25