title: Time-series/cumulative data plots using ggplot2
body: <p>Before everything, I want to thank you for reading my post.</p>
  <p>I am not very autonomous in R code language, and in the last days I've been dealing with a issue regarding ploting several time-series lines of the same data in one plot. I've already try to understand it by myself (searching on google, even several threads here), but with little to none success.</p>
  <p>In my database, I have the data of when a register was created - and if this register is valid or invalid. My objective was to do a plot, in which I would have a line with the cumulative number of total over time, as well as the cumulative value of valid and invalid registers over time.</p>
  <p>In one of my many tries, I was able to do a time series with just the total registers done over time - <a href="https://i.stack.imgur.com/0Vr9k.jpg" rel="nofollow noreferrer">Plot obtained with my script</a> -, but I'm just not able to plot it with the cumulative timeseries of valid and invalid lines all together. The script I used was:</p>
  <pre><code>
  #Graph
  ggplot(data = holocron %&gt;% group_by(Date) %&gt;% summarise(n = n()),
         aes(x = Date, y = n)) +
         ylab(&quot;Number of register&quot;) +
         xlab(&quot;Date&quot;) +
         ggtitle(&quot;Cumulative number of valid registers through time&quot;) +
         geom_line(aes(y = cumsum(n)),linetype= &quot;dotted&quot;, color=&quot;black&quot;, size=1)+
         geom_point(shape=21, aes(y = cumsum(n)), fill=&quot;yellow&quot;, color=&quot;black&quot;, size=2)+
         scale_x_date(date_breaks = &quot;months&quot;, date_labels = &quot;%m/%Y&quot;)+
         theme_bw()+
         theme(text=element_text(size=20,  family=&quot;Palatino Linotype&quot;, color=&quot;Black&quot;),
         plot.title = element_text(hjust=0.5),
         axis.title.x = element_text(color=&quot;Black&quot;, vjust = -0.5, size=18, family = &quot;Palatino Linotype&quot;),
         axis.title.y = element_text(color=&quot;Black&quot;, vjust = 2, size=18, family = &quot;Palatino Linotype&quot;))
  </code></pre>
  <p>However, with the script like this, I've tried to change it quite a few times with no success... I know this might be a really newbie mistake, but I just cant' wrap my head arount it.</p>
  <p>My data looks like this (the table presented below does not represent my data, since I couldnt find out to link the .txt file, I just did a similar table):</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Registers</th>
  <th>Valid</th>
  <th>Invalid</th>
  <th>Date</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  <td>28/11/2019</td>
  </tr>
  <tr>
  <td>2</td>
  <td>0</td>
  <td>1</td>
  <td>28/11/2019</td>
  </tr>
  <tr>
  <td>3</td>
  <td>1</td>
  <td>0</td>
  <td>28/11/2019</td>
  </tr>
  <tr>
  <td>4</td>
  <td>0</td>
  <td>1</td>
  <td>29/11/2019</td>
  </tr>
  <tr>
  <td>5</td>
  <td>0</td>
  <td>1</td>
  <td>1/12/2019</td>
  </tr>
  <tr>
  <td>6</td>
  <td>0</td>
  <td>1</td>
  <td>2/12/2019</td>
  </tr>
  <tr>
  <td>7</td>
  <td>1</td>
  <td>0</td>
  <td>2/12/2019</td>
  </tr>
  <tr>
  <td>8</td>
  <td>1</td>
  <td>0</td>
  <td>4/12/2019</td>
  </tr>
  <tr>
  <td>9</td>
  <td>1</td>
  <td>0</td>
  <td>6/12/2019</td>
  </tr>
  <tr>
  <td>10</td>
  <td>0</td>
  <td>1</td>
  <td>6/12/2019</td>
  </tr>
  <tr>
  <td>11</td>
  <td>0</td>
  <td>1</td>
  <td>8/12/2019</td>
  </tr>
  <tr>
  <td>12</td>
  <td>0</td>
  <td>1</td>
  <td>9/12/2019</td>
  </tr>
  <tr>
  <td>13</td>
  <td>0</td>
  <td>1</td>
  <td>9/12/2019</td>
  </tr>
  <tr>
  <td>14</td>
  <td>1</td>
  <td>0</td>
  <td>9/12/2019</td>
  </tr>
  <tr>
  <td>15</td>
  <td>1</td>
  <td>0</td>
  <td>9/12/2019</td>
  </tr>
  <tr>
  <td>16</td>
  <td>1</td>
  <td>0</td>
  <td>9/12/2019</td>
  </tr>
  <tr>
  <td>17</td>
  <td>1</td>
  <td>0</td>
  <td>10/12/2019</td>
  </tr>
  <tr>
  <td>18</td>
  <td>0</td>
  <td>1</td>
  <td>12/12/2019</td>
  </tr>
  <tr>
  <td>19</td>
  <td>1</td>
  <td>0</td>
  <td>12/12/2019</td>
  </tr>
  <tr>
  <td>20</td>
  <td>0</td>
  <td>1</td>
  <td>14/12/2019</td>
  </tr>
  <tr>
  <td>21</td>
  <td>1</td>
  <td>0</td>
  <td>15/12/2019</td>
  </tr>
  <tr>
  <td>22</td>
  <td>1</td>
  <td>0</td>
  <td>16/12/2019</td>
  </tr>
  <tr>
  <td>23</td>
  <td>1</td>
  <td>0</td>
  <td>17/12/2019</td>
  </tr>
  <tr>
  <td>24</td>
  <td>0</td>
  <td>1</td>
  <td>18/12/2019</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Thank you for your time and I'm eager to ready your suggestions!</p>
  <p>André Mira</p>