Blog Logo

[This article was first published on Educate-R - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Welcome to my new website/blog. I am aiming to highlight some of the R packages that I have created. You can see a list of all the R packages I have in development and also see the source code on github here: R packages. In addition, I’ll likely talk about various topics with statistics, teaching, research, or R in general.

For my first post, I want to highlight my code to generate my blog logo. The code took a lot of trial and error and definitely is dependent on the size of the image file that is outputted. By far the most difficult part of the logo was the R logo, specifically the grey oval of the R logo. I tried to get the oval to change sizes at the correct point and to do this I created a size variable in my data.frame and passed this variable to ggplot2 to make the size change. It isn’t perfect, but is a bit unique.

The next logo I need to develop is my favicon.ico. Send me suggestions in the comments of this post.

<span class="c1">### Creating words with connected points.</span>
capE <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">1.5</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1.25</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1.5</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">3</span><span class="p">,</span><span class="m">3</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1</span><span class="p">))</span>
capE<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>capE<span class="p">)</span>

letd <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">2</span><span class="p">,</span> <span class="m">1.75</span><span class="p">,</span> <span class="m">1.65</span><span class="p">,</span> <span class="m">1.75</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">2</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">1.5</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">2.5</span><span class="p">))</span>
letd<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>letd<span class="p">)</span>

letu <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">2.2</span><span class="p">,</span> <span class="m">2.2</span><span class="p">,</span> <span class="m">2.35</span><span class="p">,</span> <span class="m">2.55</span><span class="p">,</span> <span class="m">2.55</span><span class="p">,</span> <span class="m">2.55</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">1.15</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1.15</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">1</span><span class="p">))</span>
letu<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>letu<span class="p">)</span>

letc <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">3.05</span><span class="p">,</span> <span class="m">2.8</span><span class="p">,</span> <span class="m">2.7</span><span class="p">,</span> <span class="m">2.8</span><span class="p">,</span> <span class="m">3.05</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">2</span><span class="p">,</span><span class="m">2</span><span class="p">,</span><span class="m">1.5</span><span class="p">,</span><span class="m">1</span><span class="p">,</span><span class="m">1</span><span class="p">))</span>
letc<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>letc<span class="p">)</span>

leta <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">3.55</span><span class="p">,</span> <span class="m">3.35</span><span class="p">,</span> <span class="m">3.2</span><span class="p">,</span> <span class="m">3.35</span><span class="p">,</span> <span class="m">3.55</span><span class="p">,</span> <span class="m">3.55</span><span class="p">,</span> <span class="m">3.55</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">1.85</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">1.5</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> <span class="m">1.15</span><span class="p">,</span> <span class="m">1.85</span><span class="p">,</span> <span class="m">1</span><span class="p">))</span>
leta<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>leta<span class="p">)</span>

lett <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">3.75</span><span class="p">,</span> <span class="m">3.75</span><span class="p">,</span> <span class="m">3.575</span><span class="p">,</span> <span class="m">3.925</span><span class="p">,</span> <span class="m">3.75</span><span class="p">,</span> <span class="m">3.75</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">2.5</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">1</span><span class="p">))</span>
lett<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>lett<span class="p">)</span>

lete <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">4.3</span><span class="p">,</span> <span class="m">4.05</span><span class="p">,</span> <span class="m">3.95</span><span class="p">,</span> <span class="m">4.125</span><span class="p">,</span> <span class="m">4.3</span><span class="p">,</span> <span class="m">4.125</span><span class="p">,</span> <span class="m">3.95</span><span class="p">),</span> 
                   y <span class="o">=</span> c<span class="p">(</span><span class="m">1.05</span><span class="p">,</span> <span class="m">1</span><span class="p">,</span> <span class="m">1.75</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">1.75</span><span class="p">,</span> <span class="m">1.6</span><span class="p">,</span> <span class="m">1.75</span><span class="p">))</span>
lete<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>lete<span class="p">)</span>

rlogo <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">5.1</span><span class="p">,</span> <span class="m">5.1</span><span class="p">,</span> <span class="m">5.3</span><span class="p">,</span> <span class="m">5.4</span><span class="p">,</span> <span class="m">5.45</span><span class="p">,</span> <span class="m">5.4</span><span class="p">,</span> <span class="m">5.3</span><span class="p">,</span> <span class="m">5.1</span><span class="p">,</span> <span class="m">5.2</span><span class="p">,</span>
                          <span class="m">5.25</span><span class="p">,</span> <span class="m">5.35</span><span class="p">,</span> <span class="m">5.45</span><span class="p">),</span>
                    y <span class="o">=</span> c<span class="p">(</span><span class="m">.5</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">1.85</span><span class="p">,</span> <span class="m">1.675</span><span class="p">,</span> <span class="m">1.4</span><span class="p">,</span> <span class="m">1.25</span><span class="p">,</span> <span class="m">1.25</span><span class="p">,</span> <span class="m">1.25</span><span class="p">,</span>
                          <span class="m">1.2</span><span class="p">,</span> <span class="m">1.05</span><span class="p">,</span> <span class="m">.5</span><span class="p">))</span>
rlogo<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>rlogo<span class="p">)</span>

rcirclogo <span class="o"><-</span> data.frame<span class="p">(</span>x <span class="o">=</span> c<span class="p">(</span><span class="m">5.6</span><span class="p">,</span> <span class="m">5.6</span><span class="p">,</span> <span class="m">5.55</span><span class="p">,</span> <span class="m">5.45</span><span class="p">,</span> <span class="m">5.35</span><span class="p">,</span> <span class="m">5.25</span><span class="p">,</span> <span class="m">5.15</span><span class="p">,</span>
                              <span class="m">5.05</span><span class="p">,</span> <span class="m">4.95</span><span class="p">,</span> <span class="m">4.85</span><span class="p">,</span><span class="m">4.75</span><span class="p">,</span>  <span class="m">4.75</span><span class="p">,</span> <span class="m">4.75</span><span class="p">,</span>
                              <span class="m">4.8</span><span class="p">,</span> <span class="m">4.95</span><span class="p">,</span> <span class="m">5.05</span><span class="p">,</span> <span class="m">5.15</span><span class="p">,</span> <span class="m">5.25</span><span class="p">,</span> <span class="m">5.35</span><span class="p">,</span> <span class="m">5.45</span><span class="p">,</span>
                              <span class="m">5.55</span><span class="p">,</span> <span class="m">5.6</span><span class="p">,</span> <span class="m">5.6</span><span class="p">),</span>
                        y<span class="o">=</span> c<span class="p">(</span><span class="m">1.65</span><span class="p">,</span> <span class="m">1.8</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">2.15</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2.3</span><span class="p">,</span> <span class="m">2.3</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span>
                             <span class="m">2.15</span><span class="p">,</span> <span class="m">2.05</span><span class="p">,</span> <span class="m">1.85</span><span class="p">,</span> <span class="m">1.7</span><span class="p">,</span> <span class="m">1.55</span><span class="p">,</span> 
                             <span class="m">1.35</span><span class="p">,</span> <span class="m">1.15</span><span class="p">,</span> <span class="m">1.05</span><span class="p">,</span> <span class="m">.95</span><span class="p">,</span> <span class="m">.95</span><span class="p">,</span> <span class="m">1.05</span><span class="p">,</span> <span class="m">1.15</span><span class="p">,</span>
                             <span class="m">1.35</span><span class="p">,</span> <span class="m">1.55</span><span class="p">,</span> <span class="m">1.65</span><span class="p">),</span>
                        size <span class="o">=</span> c<span class="p">(</span><span class="m">2.25</span><span class="p">,</span> <span class="m">2.75</span><span class="p">,</span> <span class="m">3</span><span class="p">,</span> <span class="m">3.5</span><span class="p">,</span> <span class="m">4</span><span class="p">,</span> <span class="m">4</span><span class="p">,</span> <span class="m">4.5</span><span class="p">,</span> <span class="m">5</span><span class="p">,</span> <span class="m">5</span><span class="p">,</span>
                                 <span class="m">5</span><span class="p">,</span> <span class="m">5</span><span class="p">,</span> <span class="m">5</span><span class="p">,</span> <span class="m">5</span><span class="p">,</span> <span class="m">4.5</span><span class="p">,</span> <span class="m">4</span><span class="p">,</span> <span class="m">3.75</span><span class="p">,</span> <span class="m">3.25</span><span class="p">,</span> <span class="m">3</span><span class="p">,</span>
                                 <span class="m">2.75</span><span class="p">,</span> <span class="m">2.5</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2.25</span><span class="p">,</span> <span class="m">2</span><span class="p">))</span>
rcirclogo<span class="o">$</span>time <span class="o"><-</span> <span class="m">1</span><span class="o">:</span>nrow<span class="p">(</span>rcirclogo<span class="p">)</span>



library<span class="p">(</span>ggplot2<span class="p">)</span>
library<span class="p">(</span>scales<span class="p">)</span>

p <span class="o"><-</span> ggplot<span class="p">(</span>capE<span class="p">,</span> aes<span class="p">(</span>x <span class="o">=</span> x<span class="p">,</span> y <span class="o">=</span> y<span class="p">))</span> <span class="o">+</span> theme_bw<span class="p">()</span>
p <span class="o">+</span> geom_path<span class="p">(</span>lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> letd<span class="p">,</span> lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> letu<span class="p">,</span> lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> letc<span class="p">,</span> lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> leta<span class="p">,</span> lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> lett<span class="p">,</span>lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> lete<span class="p">,</span> lwd <span class="o">=</span> <span class="m">3</span><span class="p">,</span> lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span>
  geom_path<span class="p">(</span>data <span class="o">=</span> rcirclogo<span class="p">,</span> aes<span class="p">(</span>size <span class="o">=</span> size<span class="p">),</span> color <span class="o">=</span> <span class="s">"grey"</span><span class="p">,</span> 
            lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">,</span> linejoin <span class="o">=</span> <span class="s">"bevel"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> rlogo<span class="p">,</span> color <span class="o">=</span> <span class="s">"steelblue"</span><span class="p">,</span> lwd <span class="o">=</span> <span class="m">6</span><span class="p">,</span> 
            lineend <span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span> 
  geom_path<span class="p">(</span>data <span class="o">=</span> rlogo<span class="p">,</span> color <span class="o">=</span> <span class="s">"grey60"</span><span class="p">,</span> lwd <span class="o">=</span> <span class="m">.5</span><span class="p">,</span> 
            lineend<span class="o">=</span> <span class="s">"round"</span><span class="p">)</span> <span class="o">+</span>
  theme<span class="p">(</span>legend.position <span class="o">=</span> <span class="s">"none"</span><span class="p">,</span> text <span class="o">=</span> element_blank<span class="p">(),</span> 
        panel.grid <span class="o">=</span> element_blank<span class="p">(),</span>
        plot.background <span class="o">=</span> element_rect<span class="p">(</span>fill <span class="o">=</span> <span class="s">"transparent"</span><span class="p">,</span> 
                                       color <span class="o">=</span> <span class="kc">NA</span><span class="p">),</span>
        panel.background <span class="o">=</span> element_rect<span class="p">(</span>fill <span class="o">=</span> <span class="s">"transparent"</span><span class="p">,</span> 
                                        color <span class="o">=</span> <span class="kc">NA</span><span class="p">),</span>
        panel.border <span class="o">=</span> element_blank<span class="p">(),</span>
        axis.line <span class="o">=</span> element_blank<span class="p">(),</span> axis.ticks <span class="o">=</span> element_blank<span class="p">(),</span>
        line <span class="o">=</span> element_blank<span class="p">())</span> <span class="o">+</span> scale_size<span class="p">(</span>range <span class="o">=</span> c<span class="p">(</span><span class="m">2</span><span class="p">,</span> <span class="m">8</span><span class="p">))</span>

plot of chunk logo

To leave a comment for the author, please follow the link and comment on their blog: Educate-R - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)