<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/fireworks-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.theanalyticslab.nl/2016/12/30/fireworks-in-r/"> Rbloggers – The Analytics Lab</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<blockquote><p>New Year – a new chapter, new verse, or just the same old story ? Ultimately we write it. The choice is ours. ― Alex Morritt</p>
</blockquote>
<p>The Analytics Lab and Cmotions wish everybody a happy year. A year full of challenges, new experiences and new knowledge. </p>
<p><a target="_blank" rel="nofollow" href="https://i2.wp.com/www.theanalyticslab.nl/wp-content/uploads/2016/12/Happy-New-Year.png"><img sizes="(max-width: 225px) 100vw, 225px" alt="Happy New Year" class="wp-image-993" src="https://i2.wp.com/www.theanalyticslab.nl/wp-content/uploads/2016/12/Happy-New-Year-225x300.png?resize=225%2C300" data-recalc-dims="1"></a></p>
<p><span></span></p>
<p><a target="_blank" rel="nofollow" href="https://github.com/kromme/Fireworks-in-R">Github</a></p>
<pre>
<code>
library(ggplot2)
rm(list = ls())

# First rocket
t1 = 1:30            # number of points
size1 = 2            # size of rocket
r1_center = c(-4,10) # end center

rocket1 = data.frame(x1 = rep(r1_center[1], length(t1)) 
                , x2 = size1*cos(t1)  + r1_center[1]
                , y1 = rep(r1_center[2], length(t1))
                , y2 = size1*sin(t1) + r1_center[2]
                ) 

# Second rocket
t2 = 1:44
size2 = 3
r2_center = c(3,12)
rocket2 = data.frame(x1 = rep(r2_center[1], length(t2)) 
                     , x2 = size2*cos(t2)  + r2_center[1]
                     , y1 = rep(r2_center[2], length(t2))
                     , y2 = size2*sin(t2) + r2_center[2]
) 


# Third rocket
t3 = 1:44
size3 = 4
r3_center = c(-2,17)
rocket3 = data.frame(x1 = rep(r3_center[1], length(t3)) 
                     , x2 = size3*cos(t3)  + r3_center[1]
                     , y1 = rep(r3_center[2], length(t3))
                     , y2 = size3*sin(t3) + r3_center[2]
) 

# Fourth rocket
t4 = 1:44
size4 = 4
r4_center = c(4,20)
rocket4 = data.frame(x1 = rep(r4_center[1], length(t4)) 
                     , x2 = size4*cos(t4)  + r4_center[1]
                     , y1 = rep(r4_center[2], length(t4))
                     , y2 = size4*sin(t4) + r4_center[2]
) 



# Plot fireworks
ggplot() +
  
  # set theme
  theme(panel.background = element_rect(fill = '#252525', colour = '#252525'),
        panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
        axis.line=element_blank(),axis.text.x=element_blank(),
        axis.text.y=element_blank(),axis.ticks=element_blank(),
        axis.title.x=element_blank(),
        axis.title.y=element_blank(),legend.position=&quot;none&quot;) + 
  
  # first rocket
  geom_point(aes(x = x2, y = y2), data = rocket1, shape = 4, colour = '#74add1')+
  geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2 ), curvature = 0.1, data = rocket1, colour = '#74add1') +
  geom_curve(aes(x = 0, y = -7, xend = r1_center[1], yend = r1_center[2] ), curvature = 0.1, colour = '#878787') +
  
  # second rocket
  geom_point(aes(x = x2, y = y2), data = rocket2, shape = 4, colour = '#fed976')+
  geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), curvature = 0.1, data = rocket2, colour = '#fed976') +
  geom_curve(aes(x = 0, y = -7, xend = r2_center[1], yend = r2_center[2] ), curvature = -0.1, colour = '#878787') +

  # third rocket
  geom_point(aes(x = x2, y = y2), data = rocket3, shape = 4, colour = '#fa9fb5')+
  geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2 ), curvature = 0.1, data = rocket3, colour = '#fa9fb5') +
  geom_curve(aes(x = 0, y = -7, xend = r3_center[1], yend = r3_center[2] ), curvature = 0.1, colour = '#878787') +

  # fouth rocket
  geom_point(aes(x = x2, y = y2), data = rocket4, shape = 4, colour = '#addd8e')+
  geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2 ), curvature = 0.1, data = rocket4, colour = '#addd8e') +
  geom_curve(aes(x = 0, y = -7, xend = r4_center[1], yend = r4_center[2] ), curvature = -0.2, colour = '#878787') +
  
  # title
  ggtitle('The Analytics Lab wishes you a Happy New Year') +
  
  # save
  ggsave('Happy New Year.png', units = 'cm', width = 15, height = 20)<a target="_blank" rel="nofollow" href="https://i2.wp.com/www.theanalyticslab.nl/wp-content/uploads/2016/12/Happy-New-Year.png"><img sizes="(max-width: 225px) 100vw, 225px" alt="Happy New Year" class="wp-image-993" src="https://i2.wp.com/www.theanalyticslab.nl/wp-content/uploads/2016/12/Happy-New-Year-225x300.png?resize=225%2C300" data-recalc-dims="1"></a>

<p></p>

<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.theanalyticslab.nl/2016/12/30/fireworks-in-r/"> Rbloggers – The Analytics Lab</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/RhKGNA2oU9I"></a></div></code></pre>