as.ggplot | R Documentation |
Converts a MAgPIE object or a list of MAgPIE objects into a dataframe usable for ggplot
as.ggplot(x,scenario="default",asDate=T,rev=F,useDimNames=FALSE)
x |
MAgPIE object or list of MAgPIE objects. For a list of MAgPIE objects the name of the list entry (has to be character) is used as scenario name. |
scenario |
Name of the scenario (only used if x is not a list) or position of the entry in the third dimension that contains the scenario name (only if the scenario name is stored in the third dimension) or NULL (automatic detection) |
asDate |
Format the years as date (TRUE) or keep as is (FALSE); deprecated (only kept for compatibility with older scripts) |
rev |
reverse legend order (TRUE) or not (FALSE) |
useDimNames |
Use dim names of 3rd dimension instead Data1, Data2, Data3, Data4; works only if x is a MAgPIE object (no list) and scenario=NULL |
Dataframe usable for ggplot
Florian Humpenoeder, David Klein
## Not run:
as.ggplot(croparea(gdx))
## End(Not run)
## Not run:
prices <- list()
prices[["Scenario1"]] <- prices("Scenario1.gdx",crops=c("tece","maiz"))
prices[["Scenario2"]] <- prices("Scenario2.gdx",crops=c("tece","maiz"))
as.ggplot(prices)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.