forked from malgren/CSNAPNI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSNAPNIv1.Rmd
810 lines (753 loc) · 38.8 KB
/
CSNAPNIv1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
---
title: "Commodity-Specific Net Anthropogenic Phosphorus and Nitrogen Inputs (CSNAPNI)"
author: "Mikaela Algren"
date: "Last updated: 1/6/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
***
<center>
![FigName](CSNAPNI_fig.png)
</center>
<br>
The CSNAPNI model is designed to estimate nutrient inputs (real and embodied) to specific products, including crops, corn ethanol, and animal products, in addition to total nutrient inputs at the county and watershed scale for the conterminous United States (US).
The model is a combination of the [Net Anthropogenic Nitrogen Inputs (NANI) and Net Anthropogenic Phosphorus Inputs (NAPI) Toolboxes](http://www.eeb.cornell.edu/biogeo/nanc/nani/nani.htm), with added "commodity-specific" functionalities.
The model includes crop and animal production data for 3111 counties (or statistical equivalents) in the conterminous United States. Datasets correspond to agricultural census years 1997-2017.
## Model Tutorial (add TOC and internal links to headings)
* [Settings](#settings)
* [Create Inputs](#createinputs)
* [Load data](#load)
* [Recoverable manure](#manure)
* [Translate county-level data into watershed-level data](#cnty-ws)
* [Human N and P requirements](#hmnNP)
* [Crop production](#cropprod)
* [Meat production](#meatprod)
* [Food production totals](#foodprod)
* [Crop and ethanol fertilizer and fixation](#Cfertfix)
* [Meat impacts](#Mimpacts)
* [Impacts per nutritional units](#pernutrition)
* [Aggregate N and P inputs](#aggregateNP)
* [Write model outputs](#writeoutputs)
### Settings {#settings}
Use `Config/Settings.R` to specify:
* whether new input files should be generated from the original data sources
* this should not be necessary unless this is the first time you are running the model, or the raw data sources have been updated since the last time input files were generated)
* which allocation method to use for ethanol and ethanol coproducts
* which meat protein content assumptions to use (Costello's or DeVries')
* which data years should be included in model outputs
* which watersheds should be highlighted in the output
* the default NEEA watersheds highlighted are the Mississippi and Atchafalaya watersheds
* Note: outputs for the conterminous US are always generated
The default settings are shown in the output below.
```{r include = TRUE}
source("Config/Settings.R")
```
### Create Inputs {#createinputs}
`ModelSubs/CreateInputs.R` generates the input files needed to run CSNAPNI. As stated above, running this should only be necessary unless this is the first time you are running the model, or the raw data sources have been updated since the last time input files were generated. If you want to run `CreateInputs.R`, open the [Settings](#settings) file and make sure get_new_data==1.
```{r include = TRUE}
if(get_new_data==1){
source("ModelSubs/CreateInputs.R")
}
```
### Load Data {#load}
`ModelSubs/LoadData.R` is the program responsible for loading the data from the `InputFiles` folder into the R environment.
```{r include = TRUE}
source("ModelSubs/LoadData.R")
```
### Recoverable manure {#manure}
`ModelSubs/manure.R` uses the average annual populations of animals, calculated from agricultural census data, and corresponding confinement and manure recoverability factors from Kellogg et al. (2000) **Table 3** to estimate the amount of recoverable manure produced in each county. This method assumes that all manure is from confinement facilities.
```{r include = TRUE}
#Calculate recoverable manure for counties and 450 watersheds
source("ModelSubs/manure.R")
```
### Translate county-level data into watershed-level data {#cnty-ws}
`ModelSubs/NEEAshedsdyn.R` first determines intersections of county-level data with 450 watersheds in the conterminous US. Then it sorts crop, animal, and manure production, NANI and NAPI data, human populations, and areas corresponding to the 450 watersheds into the 144 National Estuarine Eutrophication Assessment (NEEA) watersheds (Sources: *Bricker, SB, JG Ferreira and T Simas. 2003. An integrated methodology for assessment of estuarine trophic status. Ecological Modeling. 169:39-60.* and http://ian.umces.edu/neea/).
```{r include = TRUE}
#Determine intersections of county-level data with 450 watersheds in the conterminous US
#Sort watershed-level crop, animal, manure production, NANI and NAPI toolbox, human population, and area datasets
#into 144 NEEA watersheds
source("ModelSubs/NEEAshedsdyn.R")
```
### Human N and P requirements {#hmnNP}
`ModelSubs/hmn_reqs.R` uses data from the [USDA ERS Food Availability Data System](https://www.ers.usda.gov/data-products/food-availability-per-capita-data-system/) and human population data to estimate the availability of food nutrients for people at the NEEA watershed-level.
*Author's note to self: What's the bit about total animals ws? Why is that in there and not in NEEAshedsdyn?*
```{r include = TRUE}
source("ModelSubs/hmn_reqs.R")
```
### Crop production {#cropprod}
`ModelSubs/CropProd.R` calculates various crop production and export vectors.
```{r include = TRUE}
source("ModelSubs/CropProd.R")
```
### Meat production {#meatprod}
`ModelSubs/MeatProd.R` uses the average annual populations and meat production of 19 animal types to estimate the production quantities of edible beef, pork, milk, eggs, chicken, and turkey products.
```{r include = TRUE}
source("ModelSubs/meat_alloc.R") #creates kgmeat
```
### Food production totals {#foodprod}
`ModelSubs/food_totals.R`
```{r include = TRUE}
source("ModelSubs/food_totals.R")
```
### Crop and ethanol fertilizer and fixation {#Cfertfix}
`ModelSubs/Cprodfertfix.R`
```{r include = TRUE}
## CROP, ETHANOL, and COPRODUCT FERTILIZER AND FIXATION
source("ModelSubs/Cprodfertfix.R")
```
### Meat impacts {#Mimpacts}
`ModelSubs/Mprodimpacts.R`
```{r include = TRUE}
source("ModelSubs/Mprodimpacts.R")
```
### Impacts per nutritional units {#pernutrition}
`ModelSubs/pernutrition.R`
```{r include = TRUE}
source("ModelSubs/pernutrition.R")
```
### Aggregate N and P inputs {#aggregateNP}
`ModelSubs/NPinputs_aggregate.R`
```{r include = TRUE}
## BUILD FINAL NANI/NAPI MATRICES
source("ModelSubs/NPinputs_aggregate.R")
```
### Write model outputs {#writeoutputs}
`ModelSubs/write_outputs.R` writes text files for
* total fertilizer N and P and fixation N inputs
* by commodity (crop, ethanol, and meat products)
* by watershed
* manure N and P production by meat type
* atmospheric N dep by watershed
```{r include = TRUE}
## WRITE OUTPUT DATA TO TEXT FILES
source("ModelSubs/write_outputs.R")
```
```{r include = FALSE}
source("FigureSubs/fig_setup.r") #year_labels will need to be changed if there is a change in the years offered
```
## Results
### 1. NANI
```{r NANItotals_plot,echo=FALSE,fig.width=15,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 1.1: Net Anthropogenic Nitrogen Input (NANI) totals for the US.** Results shown are from the commodity-specific NANI (CSNANI) model.*"}
positives1 <- negatives1 <- NANIBtot_US
positives1[positives1<0] <- 0
negatives1[negatives1>0] <- 0
# positives2 <- negatives2 <- NANIorigtot_US
# positives2[positives2<0] <- 0
# negatives2[negatives2>0] <- 0
# myrange <- c(min(c(colSums(negatives1),colSums(negatives2)))-1,max(c(colSums(positives1),colSums(positives2)))+1)
myrange <- c(min(colSums(negatives1))-0.1,max(colSums(positives1))+0.5)
par(mai=c(1, 3.6, 1, 0.4), xpd=TRUE, mfrow=c(1,2))
barplot(positives1,
main="a) CSNANI",
ylab="N (10^9 kg)",
col=NANI_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
ylim=myrange, bty='L', width = 1, space = 0.5)
barplot(negatives1,add=TRUE,ylim=rev(myrange),col=NANI_colors, width = 1, space = 0.5)
axis(2)
box()
legend("topright", inset=c(1.3,0), legend=c("atmospheric deposition","biological fixation","fertilizer for food","net food and feed imports","non-ag fertilizer","non-food fertilizer"), fill=NANI_colors)
# par(mai=c(1, 1, 1, 3), xpd=TRUE)
# myrange <- c(min(c(colSums(negatives1),colSums(negatives2)))-1,max(c(colSums(positives1),colSums(positives2)))+1)
# barplot(positives2,
# main="b) VB NANI Toolbox",
# ylab="N (10^9 kg)",
# col=NANI_colors,
# axes=FALSE,
# names.arg = year_labels,
# cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
# ylim=myrange, bty='L', width = 1, space = 0.5)
# barplot(negatives2,add=TRUE,ylim=rev(myrange),col=NANI_colors, width = 1, space = 0.5)
# axis(2)
# box()
```
<br>
<br>
<br>
```{r NANI_wsspec_plot,echo=FALSE,fig.width=11,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 1.2: Watershed specific NANI totals** Using new NANI.*"}
for(n in 1:nyrs){
NANI_wsspec[,n] = colSums(NANIBtot[ws,,n])/(10^9)
}
positives <- negatives <- NANI_wsspec
positives[positives<0] <- 0
negatives[negatives>0] <- 0
myrange <- c(min(colSums(negatives))-1,max(colSums(positives))+1)
par(mai=c(1, 1, 1, 4), xpd=TRUE)
barplot(positives,
main="NANI for selected watersheds",
ylab="N (10^9 kg)",
col=NANI_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
ylim=myrange, bty='L', width = 1, space = 0.5)
barplot(negatives,add=TRUE,ylim=rev(myrange),col=NANI_colors, width = 1, space = 0.5)
axis(2)
box()
legend("topright", inset=c(-0.42,0), legend=c("atmospheric deposition","biological fixation","agricultural fertilizer","net food and feed imports","domestic fertilizer","non-food fertilizer"), fill=NANI_colors)
```
<br>
<br>
<br>
```{r fertandfixN_plot,echo=FALSE,fig.width=15,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 1.3: Total commodity-disaggregated fertilizer (a) and fixation (b) inputs for selected watersheds.***"}
par(mai=c(1, 3.6, 1, 0.4), xpd=TRUE,mfrow=c(1,2))
barplot(t(total_commoddisag_fertN),
main="a) fertilizer N",
ylab="N (10^9 kg)",
col=crop_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=2, cex.main=2, cex.names = 1,
ylim=c(0,9), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
legend("topright", inset=c(1.4,0), legend=c(crop_labels,"ethanol"), fill=crop_colors)
par(mai=c(1, 1, 1, 3), xpd=TRUE)
barplot(total_commoddisag_fixN,
main="b) fixation N",
ylab="N (10^9 kg)",
col=crop_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=2, cex.main=2, cex.names = 1,
ylim=c(0,9), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
```
<br>
<br>
<br>
```{r etohNperL_plot,echo=FALSE,fig.width=11,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 1.4: Fertilizer N inputs per liter of ethanol fuel from 1987-2012.** This estimate excludes N inputs allocated to ethanol coproducts. Decreasing N inputs per liter from 1997-2007 are driven by improved corn to ethanol conversion efficiency and reduced N inputs per mass of corn. The increase in 2012 resulted from drought conditions and reduced corn yield.*"}
par(mai=c(1, 1, 1, 1), xpd=TRUE)
barplot(unitfertNetoh*10^3,
main="Fertilizer N inputs per liter of ethanol fuel",
ylab="g N / L ethanol",
col=crop_colors[20],
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
ylim=c(0,40), bty='L', width = 1, space = 0.5)
axis(2)
box()
```
```{r echo=FALSE, results = 'asis'}
library(knitr)
unitfertNetoh_df = data.frame(unitfertNetoh*10^3)
rownames(unitfertNetoh_df) = year_labels
kable(unitfertNetoh_df, caption = "Figure 1.4: Fertilizer N inputs per liter of ethanol fuel from 1987-2012. This estimate excludes N inputs allocated to ethanol coproducts. Decreasing N inputs per liter from 1997-2007 are driven by improved corn to ethanol conversion efficiency and reduced N inputs per mass of corn. The increase in 2012 resulted from drought conditions and reduced corn yield.")
```
<br>
<br>
<br>
```{r meatNperprot_plot,echo=FALSE,fig.width=20,fig.height=15,fig.cap="\\label{fig:Rn`}**Figure 1.5: Fertilizer and Fixation N inputs to animal feeds per kg protein in animal food products from 1997-2012.** Other grains are CGF, CGM, wheat, barley, sorghum, and rye. CGF, CGM, and DGS stand for corn gluten feed, corn gluten meal, and distiller’s grains and solubles, respectively."}
year_range = 1:5
par(mai=c(0.5, 4, 0.5, 0.25), xpd=TRUE, mfrow=c(3,2))
meat_type=1 #beef
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="a) beef",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
legend(cex=2.1,"topright", inset=c(1.18,0), legend=c(crop_labels[major_feeds_for_beef],"other grains"), fill=c(crop_colors[major_feeds_for_beef],"white"))
#Other grains = CGF, CGM, Wheat, Barley, Sorghum, Rye
par(mai=c(0.5, 0.75, 0.5, 3.6))
meat_type=3 #pork
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="b) pork",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 4, 0.5, 0.25))
meat_type=2 #milk
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="c) milk",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 3.6))
meat_type=6 #eggs
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="d) eggs",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 4, 0.5, 0.25))
meat_type=7 #chicken
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="e) chicken",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 3.6))
meat_type=8 #turkey
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Nimpacts_major_feeds=fertNperMprot[meat_type,major_feeds_for_beef,year_range]+fixNperMprot[meat_type,major_feeds_for_beef,year_range]
Nimpacts_minor_feeds=colSums(fertNperMprot[meat_type,minor_feeds_for_beef,year_range])+colSums(fixNperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
barplot(rbind(Nimpacts_major_feeds,Nimpacts_minor_feeds), #N requirements of meat products over time
main="f) turkey",
ylab="kg N input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white"),
axes=FALSE,
names.arg = year_labels,
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,1.8), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
```
<br>
<br>
<br>
### 2. NAPI
```{r NAPItotals_plot,echo=FALSE,fig.width=15,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 2.1: Net Anthropogenic Phosphorus Input (NAPI) totals for the US.** Results shown are from the commodity-specific NAPI (CSNAPI) model.*"}
positives1 <- negatives1 <- NAPIBtot_US
positives1[positives1<0] <- 0
negatives1[negatives1>0] <- 0
# positives2 <- negatives2 <- NAPIorigtot_US
# positives2[positives2<0] <- 0
# negatives2[negatives2>0] <- 0
# myrange <- c(min(c(colSums(negatives1),colSums(negatives2))-0.1),max(c(colSums(positives1),colSums(positives2)))+0.5)
myrange <- c(min(colSums(negatives1))-0.1,max(colSums(positives1))+0.5)
par(mai=c(1, 1, 1, 4), xpd=TRUE) #, mfrow=c(1,2))
barplot(positives1,
main="CSNAPI",
ylab="P (10^9 kg)",
col=NAPI_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.main=1.5, cex.names = 1.1,
ylim=myrange, bty='L', width = 1, space = 0.5)
barplot(negatives1,add=TRUE,axes=FALSE,ylim=rev(myrange),col=NAPI_colors, width = 1, space = 0.5)
axis(2, cex.axis = 1.1)
box()
legend("topright", inset=c(1.3,0), legend=c("fertilizer for food","net food and feed imports","non-ag fertilizer","non-food fertilizer","detergent","animal diet supplements"), fill=NAPI_colors)
# par(mai=c(1, 1, 1, 3), xpd=TRUE)
# barplot(positives2,
# main="VB NAPI Toolbox",
# ylab="P (10^9 kg)",
# col=NAPI_colors,
# axes=FALSE,
# names.arg = year_labels,
# cex.lab=1.5, cex.main=1.5, cex.names = 1.2,
# ylim=myrange, bty='L', width = 1, space = 0.5)
# barplot(negatives2,add=TRUE,axes=FALSE,ylim=rev(myrange),col=NAPI_colors, width = 1, space = 0.5)
# axis(2, cex.axis = 1.2)
# box()
```
<br>
<br>
<br>
```{r fertP_plot,echo=FALSE,fig.width=11,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 2.2: Total commodity-disagreggated fertilizer inputs for selected watersheds.***"}
par(mai=c(1, 1, 1, 4), xpd=TRUE)
barplot(t(total_commoddisag_fertP),
main="Fertilizer P: Total commodity-disaggregated inputs",
ylab="P (10^9 kg)",
col=crop_colors,
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
ylim=c(0,2), bty='L', width = 1, space = 0.5)
axis(2)
box()
legend("topright", inset=c(-0.37,0), legend=c(crop_labels,"Ethanol"), fill=crop_colors)
```
<br>
<br>
<br>
```{r etohPperL_plot,echo=FALSE,fig.width=11,fig.height=8,fig.cap="\\label{fig:Rn`}***Figure 2.3: Fertilizer P inputs per liter of ethanol fuel from 1987-2012.** This estimate excludes P inputs allocated to ethanol coproducts.*"}
par(mai=c(1, 1, 1, 1), xpd=TRUE)
barplot(unitfertPetoh*10^3,
main="Fertilizer P inputs per liter of ethanol fuel",
ylab="g P / L ethanol",
col=crop_colors[20],
axes=FALSE,
names.arg = year_labels,
cex.lab=1.5, cex.axis=1.5, cex.main=1.5,
ylim=c(0,7), bty='L', width = 1, space = 0.5)
axis(2)
box()
```
<br>
<br>
<br>
```{r meatPperprot_plot,echo=FALSE,fig.width=20,fig.height=20,fig.cap="\\label{fig:Rn`}**Figure 2.4: Fertilizer and mineral P inputs to animal feeds per kg protein in animal food products from 1997-2012.** Other grains are CGF, CGM, wheat, barley, sorghum, and rye. CGF, CGM, and DGS stand for corn gluten feed, corn gluten meal, and distiller’s grains and solubles, respectively."}
y_max = 0.5
P_supp_color = "#ADCCF6" #light blue
year_range = 1:5
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
yaxis_font_size = 2
xaxis_font_size = 2.5
ylab_font_size = 2.5
par(mai=c(0.5, 5, 0.5, 0.25), xpd=TRUE, mfrow=c(3,2))
meat_type=1 #beef
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
beefPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
beef_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="a) beef",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
legend(cex=2.5,"topright", inset=c(1.18,0), legend=c(crop_labels[major_feeds_for_beef], "other grains","diet supplements"), fill=c(crop_colors[major_feeds_for_beef],"white",P_supp_color))
#Other grains = CGF, CGM, Wheat, Barley, Sorghum, Rye
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=3 #pork
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
porkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
pork_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="b) pork",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=2 #milk
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
milkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
milk_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="c) milk",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=6 #eggs
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
eggsPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
eggs_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="d) eggs",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=7 #chicken
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
chickenPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
chicken_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="e) chicken",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=8 #turkey
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
Pimpacts_major_feeds=fertPperMprot[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMprot[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perprot[meat_type,year_range]
turkeyPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
turkey_df = data.frame(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp), #N requirements of meat products over time
main="f) turkey",
ylab="kg P input / kg protein",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=ylab_font_size, cex.axis=3, cex.main=3, cex.names = xaxis_font_size,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2, cex.axis=yaxis_font_size)
box()
```
```{r meatPperkcal_plot,echo=FALSE,fig.width=20,fig.height=20,fig.cap="\\label{fig:Rn`}**Figure 2.5: Fertilizer and mineral P inputs to animal feeds per kcal in animal food products from 1997-2012.** Other grains are CGF, CGM, wheat, barley, sorghum, and rye. CGF, CGM, and DGS stand for corn gluten feed, corn gluten meal, and distiller’s grains and solubles, respectively."}
y_max = .03
P_supp_color = "#ADCCF6" #light blue
year_range = 1:5
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
par(mai=c(0.5, 5, 0.5, 0.25), xpd=TRUE, mfrow=c(3,2))
meat_type=1 #beef
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
beefPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="a) beef",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
legend(cex=2.1,"topright", inset=c(1.18,0), legend=c(crop_labels[major_feeds_for_beef], "other grains","diet supplements"), fill=c(crop_colors[major_feeds_for_beef],"white",P_supp_color))
#Other grains = CGF, CGM, Wheat, Barley, Sorghum, Rye
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=3 #pork
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
porkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="b) pork",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=2 #milk
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
milkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="c) milk",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=6 #eggs
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
eggsPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="d) eggs",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=7 #chicken
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
chickenPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="e) chicken",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=8 #turkey
Pimpacts_major_feeds=fertPperMkcal[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPperMkcal[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_perkcal[meat_type,year_range]
turkeyPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp)*10^3,
main="f) turkey",
ylab="g P input / kcal",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
```
```{r meatPperkgmeat_plot,echo=FALSE,fig.width=20,fig.height=20,fig.cap="\\label{fig:Rn`}**Figure 2.6: Fertilizer and mineral P inputs to animal feeds per kg animal food product from 1997-2012.** Other grains are CGF, CGM, wheat, barley, sorghum, and rye. CGF, CGM, and DGS stand for corn gluten feed, corn gluten meal, and distiller’s grains and solubles, respectively."}
y_max = .1
P_supp_color = "#ADCCF6" #light blue
year_range = 1:5
major_feeds_for_beef=c(10:11,13:14,12,1:2,19) #reordered to keep grains and forage together
minor_feeds_for_beef=c(3:9,15:18)
par(mai=c(0.5, 5, 0.5, 0.25), xpd=TRUE, mfrow=c(3,2))
meat_type=1 #beef
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
beefPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="a) beef",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
legend(cex=2.1,"topright", inset=c(1.18,0), legend=c(crop_labels[major_feeds_for_beef], "other grains","diet supplements"), fill=c(crop_colors[major_feeds_for_beef],"white",P_supp_color))
#Other grains = CGF, CGM, Wheat, Barley, Sorghum, Rye
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=3 #pork
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
porkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="b) pork",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=2 #milk
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
milkPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="c) milk",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=6 #eggs
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
eggsPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="d) eggs",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 5, 0.5, 0.25))
meat_type=7 #chicken
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
chickenPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="e) chicken",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
par(mai=c(0.5, 0.75, 0.5, 4.6))
meat_type=8 #turkey
Pimpacts_major_feeds=fertPpermeat[meat_type,major_feeds_for_beef,year_range]
Pimpacts_minor_feeds=colSums(fertPpermeat[meat_type,minor_feeds_for_beef,year_range]) #this combines the minor feeds into a single category
Psupp = Psupp_permeat[meat_type,year_range]
turkeyPinputstotal = colSums(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp))
barplot(rbind(Pimpacts_major_feeds,Pimpacts_minor_feeds,Psupp),
main="f) turkey",
ylab="kg P input / kg product",
col=c(crop_colors[major_feeds_for_beef],"white",P_supp_color),
axes=FALSE,
names.arg = year_labels[year_range],
cex.lab=2, cex.axis=3, cex.main=3, cex.names = 2,
ylim=c(0,y_max), bty='L', width = 1, space = 0.5)
axis(2,cex.axis=1.5)
box()
```