2.3 Providing colour in our subplot title creating variable called subplot
subtitle <- glue::glue('penguins weight (in g) for the Species ','<span style="color:{colors["Adelie"]}">**Adelie**</span>, ','<span style="color:{colors["Chinstrap"]}">**Chinstrap**</span> ','and ','<span style="color:{colors["Gentoo"]}">**Gentoo**</span>')
2.4 Now plot the graph and remove the legend by the following code
penguins %>%ggplot(aes(x=bill_length_mm, y=body_mass_g, fill =species)) +geom_point(shape=21, size=5, alpha=0.85, color="grey10")+theme_minimal(base_size =16, base_family ='Source Sans Pro')+scale_fill_manual(values=colors)+labs(x="Bill length (in mm)",y=element_blank(),title="Penguins from palmer Archipelago",subtitle=subtitle ) +theme(plot.title.position ="plot",text =element_text(colour="grey20"),axis.text=element_text(colour="grey30"),plot.title =element_text(family="Merriweather", size=26, margin =margin(b=7, unit ="mm") ),plot.subtitle = ggtext::element_markdown(size=18, lineheight =1.3),panel.background =element_rect(colour="grey90"),panel.grid.major =element_line(colour="grey90"),panel.grid.minor =element_blank(),legend.position ="none" )
We are using markdown to make the name as bold in the subtitle, species name, removed the minor grid, faint grey colour to major grid.