library(knitr)
opts_chunk$set(fig.width=10, fig.height=7)
opts_chunk$set(echo=FALSE)
library(ggplot2)
library(dplyr)
library(reshape2)
# opts_chunk$set(cache=TRUE) # Set global chunk options
# comment this load function as the object is loaded in knit_reports.R now
# load("enddata/GFPM_training_scenarios_with_historical.RDATA")
# Extract prices
gfpmprices <- gfpm %>% 
    filter(Element==  "DPrice") %>%
    mutate(Volume = Volume /1000)
# Remove prices from the main table as they will be displayed on
# a different graph
gfpmvolume <- gfpm %>% filter(Element!=  "DPrice")

Paper products

paperproducts <- c("Newsprint", "PWPaper", "OthPaper")
ggplot(data=filter(gfpmvolume, Country==country & Product %in% paperproducts)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + 
    facet_grid(Element ~ Product) +
    ylab("Tons") + ggtitle("Volume")
p <- ggplot(data=filter(gfpmprices, Country==country & 
                            Product %in% paperproducts)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + ylab("$/T") + xlim(1990, NA) +
    facet_wrap(~Product) + ggtitle("Prices")
try(plot(p))

Solid wood

solidwoodproducts <- c("Fuelwood", "IndRound", "Sawnwood", "OthIndRound")
ggplot(data=filter(gfpmvolume, Country==country & 
                       Product %in% solidwoodproducts)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + 
    ylab(expression(paste("Volume ",m^3))) +
    facet_grid(Element ~ Product)
    ```


```r
p <- ggplot(data=filter(gfpmprices, Country==country & 
                            Product %in% solidwoodproducts)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + xlim(1990, NA) +
    ylab(expression(paste("$/",m^3))) + ggtitle("Prices") + 
    facet_wrap(~Product) 
try(plot(p))

Wood panels

woodpanels <- c( "Plywood", "ParticleB" , "FiberB")
ggplot(data=filter(gfpmvolume, Country==country & 
                       Product %in% woodpanels)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) +
    ylab(expression(paste("Volume ",m^3))) +
    facet_grid(Element ~ Product)
p <- ggplot(data=filter(gfpmprices, Country==country & 
                            Product %in% woodpanels)) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + xlim(1990, NA) +
    ylab(expression(paste("$/",m^3))) + ggtitle("Prices") +
    facet_wrap(~Product) 
try(plot(p))

Other products

ggplot(data=filter(gfpmvolume, Country==country &
                       ! Product %in% c(paperproducts, 
                                        solidwoodproducts, 
                                        woodpanels))) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) +
    ylab(expression(paste("Volume ",m^3))) +
    facet_grid(Element ~ Product)
p <- ggplot(data=filter(gfpmprices, Country==country & 
                       ! Product %in% c(paperproducts, 
                                        solidwoodproducts, 
                                        woodpanels))) +
    aes(x=Year, y=Volume, color=Element, linetype=Scenario) +
    geom_line() + ylim(0,NA) + xlim(1990, NA) +
    ylab(expression(paste("$/",m^3))) + ggtitle("Prices") +
    facet_wrap(~Product) 
try(plot(p))


paul4forest/GFPMoutput documentation built on May 24, 2019, 8:25 p.m.