Q: Problem with plotly Charts Being Deprecated in RStudio I'm trying to get familiar with plotly's functionality and syntax and have tried several of the scripts provided to compose and render plots of data.  However, when generating the plotly output using RStudio I'm getting the following error: "Warning message:
Specifying width/height in layout() is now deprecated.
Please specify in ggplotly() or plot_ly()"
The output image appears jumbled and uninterpretable in the RStudio console and I've tried a few changes like setting the plotly object's width and height equal to null etc without luck.  
Here is one of the sample scripts I've used when experiencing this issue:
library(plotly)
trace1 <- list(
  x = c("Aug-12", "Sep-12", "Oct-12", "Nov-12", "Dec-12", "Jan-12", "Feb-13", "Mar-13", "Apr-13", "May-13", "Jun-13", "Jul-13"), 
  y = c(65, 77, 112, 279, 172, 133, 152, 106, 79, 225, 99, 150), 
  hoverinfo = "x+y+name", 
  line = list(
    color = "#5BC075", 
    width = "3"
  ), 
  mode = "lines", 
  name = "Median deal size", 
  type = "scatter", 
  uid = "a8e83b", 
  xsrc = "jackluo:508:b357d2", 
  ysrc = "jackluo:508:d19900"
)
trace2 <- list(
  x = c("Aug-12", "Sep-12", "Oct-12", "Nov-12", "Dec-12", "Jan-12", "Feb-13", "Mar-13", "Apr-13", "May-13", "Jun-13", "Jul-13"), 
  y = c(116, 125, 126, 125, 244, 136, 80, 82, 89, 82, 95, 107), 
  hoverinfo = "x+y+name", 
  line = list(
    color = "#CC6E55", 
    width = "3"
  ), 
  mode = "lines", 
  name = "Number of deals", 
  type = "scatter", 
  uid = "2be33b", 
  xsrc = "jackluo:508:b357d2", 
  ysrc = "jackluo:508:5d533d"
)
data <- list(trace1, trace2)
layout <- list(
  autosize = TRUE, 
  font = list(
    family = "Overpass", 
    size = 12
  ), 
  height = 720, 
  legend = list(
    x = 0, 
    y = -0.1, 
    bgcolor = "rgba(255, 255, 255, 0)", 
    orientation = "h"
  ), 
  margin = list(
    r = 40, 
    t = 40, 
    b = 40, 
    l = 40, 
    pad = 2
  ), 
  title = "", 
  width = 1280, 
  xaxis = list(
    autorange = TRUE, 
    nticks = 12, 
    range = c(0, 11), 
    rangemode = "tozero", 
    type = "category"
  ), 
  yaxis = list(
    autorange = TRUE, 
    range = c(0, 293.6842105263158), 
    rangemode = "tozero", 
    type = "linear"
  )
)
p <- plot_ly()
p <- add_trace(p, x=trace1$x, y=trace1$y, hoverinfo=trace1$hoverinfo, line=trace1$line, mode=trace1$mode, name=trace1$name, type=trace1$type, uid=trace1$uid, xsrc=trace1$xsrc, ysrc=trace1$ysrc)
p <- add_trace(p, x=trace2$x, y=trace2$y, hoverinfo=trace2$hoverinfo, line=trace2$line, mode=trace2$mode, name=trace2$name, type=trace2$type, uid=trace2$uid, xsrc=trace2$xsrc, ysrc=trace2$ysrc)
p <- layout(p, autosize=layout$autosize, font=layout$font, height=layout$height, legend=layout$legend, margin=layout$margin, title=layout$title, width=layout$width, xaxis=layout$xaxis, yaxis=layout$yaxis)
p$x$layout$width <- NULL
p$x$layout$height <- NULL
p$width <- NULL
p$height <- NULL
p

Any help resolving this issue so charts are correctly scaled and legible would be much appreciated!

A: 
As @NoahOlsen suggested, you need to format your x-axis values as a date.
trace1$x <- as.Date(paste0("01-", trace1$x), format = "%d-%b-%y")
trace2$x <- as.Date(paste0("01-", trace2$x), format = "%d-%b-%y")


Explanation
as.Date() tries to format an input into a date object. It works well with ISO date strings (e.g., 2019-04-21), but needs some help with more tricky formats. 
From ?strptime:
%d - Day of the month as decimal number (01–31).
%b - Abbreviated month name in the current locale on this platform. (Also matches full name on input: in some locales there are no abbreviations of names.)
%Y - Year with century. Note that whereas there was no zero in the original Gregorian calendar, ISO 8601:2004 defines it to be valid (interpreted as 1BC): see https://en.wikipedia.org/wiki/0_(year). Note that the standards also say that years before 1582 in its calendar should only be used with agreement of the parties involved. For input, only years 0:9999 are accepted.

Furthermore, we also need a specific day of the month. As it does not exist in your data, I added 01- via paste0() to every value of the date vector. Other values, such as 15-, would also have been a valid choice (depending on your data and what type of output you expect). This way, we can make the function recognize your date via format = "%d-%b-%y".
Check out ?as.Date and ?strptime for more information. Ping me if you require further guidance. Happy to help.  

A: It looks like your X axis is a character rather than a date so the axis is sorted alphabetically rather than chronologically. I would try making the x values dates.
