Giter Club home page Giter Club logo

gcammaptools's Introduction

Build Status

gcammaptools

Overview

The gcammaptools package provides functions for plotting GCAM data on world or regional maps. This includes functions for making plots for regional or gridded data, as well as default projection and theme settings that provide a house style for GCAM plots.

Installation

This package must be installed from the github repository using install_github. To do this, you will need to install devtools first if you don't have it already.

install.packages('devtools') # if you don't have it already
devtools::install_github('JGCRI/gcammaptools')

Optionally, you can build the "examples" vignette, which shows how to do several common mapping tasks. To build these examples, replace the install_github command above with:

devtools::install_github('JGCRI/gcammaptools', dependencies=TRUE,
                         build_vignettes=TRUE)

You can display the vignette by running

vignette('examples','gcammaptools')

Sometimes R can't find the CRAN repository without help. If during the install_github steps you get errors about missing packages or functions, rerun them with the repos option:

cran <- 'http://cran.us.r-project.org'
devtools::install_github('JGCRI/gcammaptools', build_vignettes=TRUE,
                         dependencies=TRUE, repos=cran)

This should allow R to fetch the packages it needs to complete the installation from CRAN.

Usage

Preparing GCAM data

The recommended way to load your GCAM data is by using the rgcam package create a project data file from a GCAM database, and then querying that file for the data you want to plot.

prj <- rgcam::loadProject('myproj.dat')
co2 <- rgcam::getQuery(prj, 'CO2 emissions by region', 'Reference')

Alternatively, you can start with any data frame that has a region column and one or more data columns.

Once you have loaded the data, you must add the region identifiers used in the map data to the data frame using the add_region_ID function:

co2 <- add_region_ID(co2)

Plotting maps

The main plotting function is plot_GCAM. You can supply your own map of region boundaries, but most of the time you will want to use the ones supplied with the package. plot_GCAM:

plot_GCAM(map.rgn32, col='value', gcam_df=co2, title='CO2 Emissions', legend=TRUE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.