Science, culture, complexity

Tag: R

  • Plotting transmission losses

    Transmission loss in GWh in India. Data from Central Electricity Authority. Click on the image for hi-res version. All data available here.

    transmission loss v. year

    Transmission loss as % of net generation in GWh. Net generation = Gross generation — consumption by auxiliary power plant unitstransmission loss as  of net generation in GWh

    (Model used to fit: LOESS)


    Rise of net supply to ultimate consumers and exports v. purchase of power from non-utilities and imports before transmission. Note different y-axes: net supply, right; purchase, left; both in GWh

    purcsupp

  • Motion charts in R

    Formatting a motion chart in Google Visualization is as hellish as it’s surprising how simple R makes it. One more reason to learn this underrated language. To create this motion chart, I downloaded the data from here (as CSV) and keyed in the following lines in RStudio:

    [code language=”r”]

    emissions <- read.csv("–path to file–/emissions.csv", header=T)
    install.packages("googleVis")
    library("googleVis)
    emissions_Motion = gvisMotionChart(emissions, idvar="Country", timevar="Year")
    plot(emissions_Motion)
    cat(emissions_Motion$html$chart, file="emissions.html")

    [/code]

    That’s it.