title: Aesthetics not right, might be related to melt function
body: <p>I have the following task: 
  -Extrect 2 tabs from an URL Excel file (contain hourly data)
  -In one tab I am only interested in the data point at 16:00, and hence filter for it
  -In the second tab I am interested in all data points, but to be aligned, I create a daily average of the 24 hourly values </p>
  
  <p>Then, I use some sort of cbind.fill function because I want to merge the data. This is necessary, as I get my 16:00 only at 16:00 of course and couldnt use CBIND before 16:00 as I would have one less line as I have in the aggregated tab.</p>
  
  <p>Then I do some variable filtering and renaming.</p>
  
  <p>Before plotting I use the melt function in order to create some sort of subchart. Here might lie the problem, I also get a warning when running the code. I don't understand why but I struggle to convert the levels from factors to numerical characters. </p>
  
  <p>I can still plot in the end but the x axis looks hideous. It is actually not such a difficult task but I am getting nowhere. If you could give me a hint, I'd appreciate it.</p>
  
  <p>Thanks in advance!</p>
  
  <p>The code:</p>
  
  <pre><code>is.installed &lt;- function(mypkg){
    is.element(mypkg, installed.packages()[,1])
  } 
  if (!is.installed("ggplot2")){
    install.packages("ggplot2")
  }
  if (!is.installed("lubridate")){
    install.packages("lubridate")
  }
  if (!is.installed("openxlsx")){
    install.packages("openxlsx")
  }
  library(ggplot2)
  library(lubridate)
  library(openxlsx)
  library(reshape2)
  library(dplyr)
  
  Storico_G &lt;- read.xlsx(xlsxFile = "http://www.snamretegas.it/repository/file/Info-storiche-qta-gas-trasportato/dati_operativi/2017/DatiOperativi_2017-IT.xlsx",sheet = "Storico_G", startRow = 1, colNames = TRUE)
  
  Storico_G1 &lt;- read.xlsx(xlsxFile = "http://www.snamretegas.it/repository/file/Info-storiche-qta-gas-trasportato/dati_operativi/2017/DatiOperativi_2017-IT.xlsx",sheet = "Storico_G+1", startRow = 1, colNames = TRUE)
  
  # Selecting Column C,E,R from Storico_G and stored in variable Storico_G_df
  # Selecting Column A,P from Storico_G+1 and stored in variable Storico_G1_df
  
  Storico_G_df &lt;- data.frame(Storico_G$pubblicazione,Storico_G$IMMESSO, Storico_G$`RICONSEGNATO.(1)`, Storico_G$BILANCIAMENTO.RESIDUALE )
  Storico_G1_df &lt;- data.frame(Storico_G1$pubblicazione, Storico_G1$`SBILANCIAMENTO.ATTESO.DEL.SISTEMA.(SAS)`)
  
  
  # Conerting pubblicazione in date format and time
  Storico_G_df$pubblicazione &lt;- ymd_h(Storico_G_df$Storico_G.pubblicazione)
  Storico_G1_df$pubblicazione   &lt;- ymd_h(Storico_G1_df$Storico_G1.pubblicazione)
  
  
  # Selecting on row which is having 4PM value in Storico_G+1 excel sheet tab
  Storico_G1_df &lt;- subset(Storico_G1_df, hour(Storico_G1_df$pubblicazione) == 16)
  rownames(Storico_G1_df) &lt;- 1:nrow(Storico_G1_df)
  
  # Averaging hourly values to 1 daily data point in G excel sheet tab
  Storico_G_df$Storico_G.pubblicazione &lt;- strptime(Storico_G_df$Storico_G.pubblicazione, "%Y_%m_%d_%H")
  storico_G_df_agg &lt;- aggregate(Storico_G_df, by=list(day=format(Storico_G_df$Storico_G.pubblicazione, "%F")), FUN=mean, na.rm=TRUE)[,-2]
  
  #cbind.fill function
  cbind.fill &lt;- function(...){
      nm &lt;- list(...) 
      nm &lt;- lapply(nm, as.matrix)
      n &lt;- max(sapply(nm, nrow)) 
      do.call(cbind, lapply(nm, function (x) 
          rbind(x, matrix(, n-nrow(x), ncol(x))))) 
  }
  
  #cbind with both frames
  G_G1_df= data.frame(cbind.fill(storico_G_df_agg,Storico_G1_df))
  
  #keep required columns
  keep=c("Storico_G.IMMESSO","Storico_G..RICONSEGNATO..1..","Storico_G1..SBILANCIAMENTO.ATTESO.DEL.SISTEMA..SAS..")
  
  #update dataframe to kept variables
  G_G1_df=G_G1_df[,keep,drop=FALSE]
  
  #add counting variable
  G_G1_df$X=seq(nrow(G_G1_df))
  
  #Rename crazy variable names
  G_G1_df &lt;- data.frame(G_G1_df) %&gt;% 
       select(Storico_G.IMMESSO, Storico_G..RICONSEGNATO..1.., Storico_G1..SBILANCIAMENTO.ATTESO.DEL.SISTEMA..SAS.., X)
  names(G_G1_df) &lt;- c("Immesso","Riconsegnato", "SAS","X")
  
  #Melt time series
  G_G1_df=melt(G_G1_df,id.vars = "X")
  
  #Create group variable
  G_G1_df$group&lt;- ifelse(G_G1_df$variable == "SAS", "SAS", "Immesso/Consegnato")
  
  #plot
  ggplot(G_G1_df, aes(X,value, col=variable))+geom_point()+geom_line()+facet_wrap(~group,ncol=1,scales="free_y")+geom_abline(intercept=c(-2,0,2),slope=0,data=subset(G_G1_df,group=="SAS"),lwd=0.5,lty=2)
  </code></pre>