data("greenhouse_gases")
#head(greenhouse_gases)
tail(greenhouse_gases)
##     year gas concentration
## 295 1900 N2O         277.2
## 296 1920 N2O         285.2
## 297 1940 N2O         287.7
## 298 1960 N2O         292.3
## 299 1980 N2O         302.6
## 300 2000 N2O         315.4
print(greenhouse_gases)
##     year gas concentration
## 1     20 CO2         277.7
## 2     40 CO2         277.8
## 3     60 CO2         277.3
## 4     80 CO2         277.3
## 5    100 CO2         277.5
## 6    120 CO2         277.6
## 7    140 CO2         278.3
## 8    160 CO2         279.7
## 9    180 CO2         280.4
## 10   200 CO2         280.6
## 11   220 CO2         281.3
## 12   240 CO2         281.4
## 13   260 CO2         280.6
## 14   280 CO2         280.0
## 15   300 CO2         279.8
## 16   320 CO2         279.3
## 17   340 CO2         278.3
## 18   360 CO2         277.2
## 19   380 CO2         276.7
## 20   400 CO2         276.7
## 21   420 CO2         276.9
## 22   440 CO2         276.9
## 23   460 CO2         276.7
## 24   480 CO2         276.6
## 25   500 CO2         276.4
## 26   520 CO2         275.9
## 27   540 CO2         276.1
## 28   560 CO2         277.3
## 29   580 CO2         277.4
## 30   600 CO2         276.9
## 31   620 CO2         277.6
## 32   640 CO2         278.6
## 33   660 CO2         279.2
## 34   680 CO2         279.7
## 35   700 CO2         279.7
## 36   720 CO2         278.9
## 37   740 CO2         278.4
## 38   760 CO2         278.5
## 39   780 CO2         278.5
## 40   800 CO2         278.5
## 41   820 CO2         278.8
## 42   840 CO2         279.2
## 43   860 CO2         279.3
## 44   880 CO2         279.1
## 45   900 CO2         278.9
## 46   920 CO2         279.1
## 47   940 CO2         279.1
## 48   960 CO2         278.7
## 49   980 CO2         278.4
## 50  1000 CO2         279.0
## 51  1020 CO2         280.7
## 52  1040 CO2         280.5
## 53  1060 CO2         282.9
## 54  1080 CO2         282.7
## 55  1100 CO2         282.6
## 56  1120 CO2         283.4
## 57  1140 CO2         283.8
## 58  1160 CO2         283.9
## 59  1180 CO2         283.9
## 60  1200 CO2         283.8
## 61  1220 CO2         282.8
## 62  1240 CO2         281.7
## 63  1260 CO2         282.0
## 64  1280 CO2         280.9
## 65  1300 CO2         281.0
## 66  1320 CO2         283.1
## 67  1340 CO2         281.9
## 68  1360 CO2         279.2
## 69  1380 CO2         279.7
## 70  1400 CO2         280.2
## 71  1420 CO2         278.8
## 72  1440 CO2         283.0
## 73  1460 CO2         280.2
## 74  1480 CO2         280.1
## 75  1500 CO2         282.3
## 76  1520 CO2         283.1
## 77  1540 CO2         283.2
## 78  1560 CO2         281.8
## 79  1580 CO2         282.2
## 80  1600 CO2         275.4
## 81  1620 CO2         272.3
## 82  1640 CO2         276.6
## 83  1660 CO2         276.9
## 84  1680 CO2         275.9
## 85  1700 CO2         276.6
## 86  1720 CO2         277.0
## 87  1740 CO2         277.2
## 88  1760 CO2         276.5
## 89  1780 CO2         278.2
## 90  1800 CO2         282.6
## 91  1820 CO2         283.3
## 92  1840 CO2         284.0
## 93  1860 CO2         286.1
## 94  1880 CO2         289.8
## 95  1900 CO2         296.1
## 96  1920 CO2         303.4
## 97  1940 CO2         310.5
## 98  1960 CO2         316.1
## 99  1980 CO2         335.9
## 100 2000 CO2         366.8
## 101   20 CH4         638.1
## 102   40 CH4         631.1
## 103   60 CH4         628.2
## 104   80 CH4         628.3
## 105  100 CH4         630.9
## 106  120 CH4         635.4
## 107  140 CH4         639.2
## 108  160 CH4         640.5
## 109  180 CH4         641.7
## 110  200 CH4         641.4
## 111  220 CH4         635.2
## 112  240 CH4         629.4
## 113  260 CH4         627.5
## 114  280 CH4         626.6
## 115  300 CH4         624.6
## 116  320 CH4         621.0
## 117  340 CH4         618.7
## 118  360 CH4         619.9
## 119  380 CH4         624.3
## 120  400 CH4         630.3
## 121  420 CH4         635.1
## 122  440 CH4         636.5
## 123  460 CH4         638.6
## 124  480 CH4         648.9
## 125  500 CH4         659.5
## 126  520 CH4         660.7
## 127  540 CH4         656.9
## 128  560 CH4         654.1
## 129  580 CH4         650.4
## 130  600 CH4         644.0
## 131  620 CH4         636.2
## 132  640 CH4         633.8
## 133  660 CH4         638.9
## 134  680 CH4         645.5
## 135  700 CH4         649.8
## 136  720 CH4         650.6
## 137  740 CH4         648.4
## 138  760 CH4         644.5
## 139  780 CH4         640.9
## 140  800 CH4         642.6
## 141  820 CH4         652.6
## 142  840 CH4         659.1
## 143  860 CH4         656.9
## 144  880 CH4         651.7
## 145  900 CH4         646.8
## 146  920 CH4         644.8
## 147  940 CH4         646.4
## 148  960 CH4         651.5
## 149  980 CH4         656.1
## 150 1000 CH4         662.4
## 151 1020 CH4         677.0
## 152 1040 CH4         677.1
## 153 1060 CH4         671.6
## 154 1080 CH4         675.0
## 155 1100 CH4         675.9
## 156 1120 CH4         679.3
## 157 1140 CH4         686.5
## 158 1160 CH4         688.6
## 159 1180 CH4         686.8
## 160 1200 CH4         681.7
## 161 1220 CH4         670.1
## 162 1240 CH4         660.0
## 163 1260 CH4         670.6
## 164 1280 CH4         688.2
## 165 1300 CH4         691.6
## 166 1320 CH4         680.2
## 167 1340 CH4         670.0
## 168 1360 CH4         667.8
## 169 1380 CH4         677.5
## 170 1400 CH4         670.6
## 171 1420 CH4         672.8
## 172 1440 CH4         685.8
## 173 1460 CH4         680.8
## 174 1480 CH4         670.7
## 175 1500 CH4         690.1
## 176 1520 CH4         702.0
## 177 1540 CH4         700.1
## 178 1560 CH4         712.3
## 179 1580 CH4         678.1
## 180 1600 CH4         665.1
## 181 1620 CH4         680.0
## 182 1640 CH4         686.7
## 183 1660 CH4         674.7
## 184 1680 CH4         691.6
## 185 1700 CH4         669.2
## 186 1720 CH4         667.0
## 187 1740 CH4         706.5
## 188 1760 CH4         700.0
## 189 1780 CH4         718.2
## 190 1800 CH4         726.6
## 191 1820 CH4         739.5
## 192 1840 CH4         765.9
## 193 1860 CH4         786.2
## 194 1880 CH4         826.5
## 195 1900 CH4         865.0
## 196 1920 CH4         957.3
## 197 1940 CH4        1062.8
## 198 1960 CH4        1205.5
## 199 1980 CH4        1495.3
## 200 2000 CH4        1703.4
## 201   20 N2O         263.2
## 202   40 N2O         263.3
## 203   60 N2O         264.4
## 204   80 N2O         265.5
## 205  100 N2O         266.2
## 206  120 N2O         266.4
## 207  140 N2O         265.9
## 208  160 N2O         265.2
## 209  180 N2O         265.5
## 210  200 N2O         266.9
## 211  220 N2O         268.1
## 212  240 N2O         268.1
## 213  260 N2O         266.6
## 214  280 N2O         264.5
## 215  300 N2O         262.5
## 216  320 N2O         261.4
## 217  340 N2O         261.9
## 218  360 N2O         263.5
## 219  380 N2O         264.3
## 220  400 N2O         264.2
## 221  420 N2O         263.7
## 222  440 N2O         263.4
## 223  460 N2O         263.2
## 224  480 N2O         262.8
## 225  500 N2O         261.7
## 226  520 N2O         260.0
## 227  540 N2O         260.6
## 228  560 N2O         264.0
## 229  580 N2O         263.8
## 230  600 N2O         260.8
## 231  620 N2O         261.5
## 232  640 N2O         262.4
## 233  660 N2O         261.5
## 234  680 N2O         261.2
## 235  700 N2O         262.1
## 236  720 N2O         264.0
## 237  740 N2O         266.2
## 238  760 N2O         268.4
## 239  780 N2O         270.1
## 240  800 N2O         270.7
## 241  820 N2O         270.1
## 242  840 N2O         269.4
## 243  860 N2O         269.5
## 244  880 N2O         271.0
## 245  900 N2O         272.1
## 246  920 N2O         271.5
## 247  940 N2O         269.7
## 248  960 N2O         267.5
## 249  980 N2O         266.0
## 250 1000 N2O         265.3
## 251 1020 N2O         265.4
## 252 1040 N2O         265.8
## 253 1060 N2O         266.6
## 254 1080 N2O         267.4
## 255 1100 N2O         268.2
## 256 1120 N2O         268.6
## 257 1140 N2O         268.6
## 258 1160 N2O         268.5
## 259 1180 N2O         268.2
## 260 1200 N2O         267.8
## 261 1220 N2O         267.5
## 262 1240 N2O         267.4
## 263 1260 N2O         267.7
## 264 1280 N2O         268.4
## 265 1300 N2O         269.3
## 266 1320 N2O         269.7
## 267 1340 N2O         269.4
## 268 1360 N2O         268.3
## 269 1380 N2O         267.1
## 270 1400 N2O         266.2
## 271 1420 N2O         266.4
## 272 1440 N2O         267.1
## 273 1460 N2O         266.4
## 274 1480 N2O         265.8
## 275 1500 N2O         268.2
## 276 1520 N2O         273.2
## 277 1540 N2O         269.9
## 278 1560 N2O         270.1
## 279 1580 N2O         269.2
## 280 1600 N2O         267.4
## 281 1620 N2O         265.3
## 282 1640 N2O         264.5
## 283 1660 N2O         265.9
## 284 1680 N2O         269.8
## 285 1700 N2O         271.2
## 286 1720 N2O         270.0
## 287 1740 N2O         269.4
## 288 1760 N2O         274.1
## 289 1780 N2O         272.4
## 290 1800 N2O         272.6
## 291 1820 N2O         272.9
## 292 1840 N2O         269.6
## 293 1860 N2O         271.7
## 294 1880 N2O         275.8
## 295 1900 N2O         277.2
## 296 1920 N2O         285.2
## 297 1940 N2O         287.7
## 298 1960 N2O         292.3
## 299 1980 N2O         302.6
## 300 2000 N2O         315.4
summary(greenhouse_gases)
##       year          gas            concentration   
##  Min.   :  20   Length:300         Min.   : 260.0  
##  1st Qu.: 515   Class :character   1st Qu.: 269.7  
##  Median :1010   Mode  :character   Median : 279.7  
##  Mean   :1010                      Mean   : 416.2  
##  3rd Qu.:1505                      3rd Qu.: 641.0  
##  Max.   :2000                      Max.   :1703.4
str(greenhouse_gases)
## 'data.frame':    300 obs. of  3 variables:
##  $ year         : num  20 40 60 80 100 120 140 160 180 200 ...
##  $ gas          : chr  "CO2" "CO2" "CO2" "CO2" ...
##  $ concentration: num  278 278 277 277 278 ...

Add X and Y labels

ggplot(greenhouse_gases, aes(x = year, y = concentration, color = gas)) + geom_line() + geom_point() + ggtitle("Greenhouse Gases since 1740") + xlab("Year") + ylab("Concentration")

Center title

Change font to Times New Roman and Adjust Size

ggplot(greenhouse_gases, aes(x = year, y = concentration, color = gas)) + geom_line() + geom_point() + ggtitle("Greenhouse Gases since 1740") + xlab("Year") + ylab("Concentration") + theme(plot.title = element_text(hjust = 0.5), text = element_text(family = "Times New Roman", size= 18))
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

#Adjust axes font size #Separate lines to make code more readable #Make title text bold

ggplot(greenhouse_gases, aes(x = year, y = concentration, color = gas)) + 
geom_line() + geom_point() + 
  ggtitle("Greenhouse Gases since 1740")  + 
  xlab("Year") + 
ylab("Concentration") + 
theme(plot.title = element_text(hjust = 0.5), text = element_text(family = "Times New Roman", size= 14)) +
xlim(min=1740, max = 2020) + labs(color = "Gases") + scale_color_hue(labels= c("CH4" = "Methane (CH4)", "CO2" = "Carbon Dioxide (CO2)", "N2O" = "Nitrous Oxide (N2O")) + 
  theme(legend.title = element_text(size = 8), legend.text = element_text(size = 8)) + theme(axis.text=element_text(size=10),
axis.title=element_text(size=12, face = "bold")) + 
theme(plot.title = element_text(face = "bold"))
## Warning: Removed 258 row(s) containing missing values (geom_path).
## Warning: Removed 258 rows containing missing values (geom_point).
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database

## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
## found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
## family not found in Windows font database

Depicted here are the concentrations of the three main greenhouse gasses, from the year 1740 until the year 2000. which occurred during the second half of the 18th century, had a profound effect on the concentrations of greenhouse gases in our atmosphere. Before 1800 shows few data points almost no change or the line is constant.After 1800 century where green gas emission start to increase significantly for methane gas.