File:NzGDPdata 720by540.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (SVG file, nominally 768 × 576 pixels, file size: 185 KB)

Captions

Captions

New Zealand gross domestic product and net international debt

Summary

[edit]
Description
English: New Zealand gross domestic product and net international debt from 2000
Date
Source Own work
Author Mrfebruary
SVG development
InfoField
 
The SVG code is valid.
 
This coat of arms was created with R.
 
This SVG coat of arms uses the path text method.
Source code
InfoField

R code

# manually download the file hm7.xlsx from https://www.rbnz.govt.nz/statistics/m7 and save it to the working directory
# load readxl program to read Microsoft Excel format files
library(readxl)
# read in data
debt <-read_excel("hm7.xlsx", sheet = "Data", range ="A5:N155", col_names = T, skip =4,col_types = c("numeric"))
names(debt)[1] <- "Date"
debt[["Date"]] <- as.Date(debt[["Date"]], origin = "1899-12-30")
# create new dataframe
data <- data.frame(Date =debt[["Date"]],NetDebt = debt[["IIP.Q.TA.NA"]],Debt2GDp =debt[["BOPR.Q.TJ102.na"]])
# convert from negative to positive values
data$NetDebt <- sqrt(data$NetDebt * data$NetDebt)
data$Debt2GDp <- sqrt(data$Debt2GDp * data$Debt2GDp)
# calculate GDP and add to data
data$GDP <- data$NetDebt / ( data$Debt2GDp * .01) 
# create svg format chart of net debt with 14 pt text font and grid lines via 'grid' with y axis as 0 to 200
svg(filename="nzGDPdata_720by540.svg", width = 8, height = 6, pointsize = 14, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel"))  
par(mar=c(2.7,3,1,1)+0.1)
plot(data[["Date"]], data[["GDP"]]/10^3,ylim=c(0,420),tck=0.01,axes=TRUE,ann=TRUE, las=1,col="#CC0000",lwd=1,type='l',lty=1,ylab="", xlab="")                                                  # Guardsman Red "#CC0000" 
grid(col="darkgray",lwd=1)
points(data[["Date"]],data[["GDP"]]/10^3,col="#CC0000",pch=19,cex = 0.6)     # Guardsman Red "#CC0000"            
lines(data[["Date"]],data[["NetDebt"]]/10^3,col="#000099",cex = 0.6)            # "#000099" is navy blue
points(data[["Date"]],data[["NetDebt"]]/10^3,col="#000099",pch=19,cex = 0.6)    # "#000099" is navy blue
axis(side=4, tck=0.01, las=0,tick=TRUE,labels = FALSE)
mtext(side=1,cex=0.9,line=-1.3,"Data: https://www.rbnz.govt.nz/statistics/m7 \nBalance of Payments and International Investment Position - M7")
mtext(side=3,cex=1.4, line=-2.2,expression(paste("New Zealand GDP and Net Debt from 2000")) )
mtext(side=2,cex=0.9, line=-1.3,"NZ$ Billions")
mtext(side=4,cex=0.75, line=0.05,R.version.string)
legend(as.numeric(data[["Date"]][1]),350, bty = "n", c("Gross Domestic Product","Net International Debt"), col=c("#CC0000", "#000099"), cex= 1, text.col = 1, lty = 1, pch = c(19,19))
dev.off()

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current04:06, 28 September 2024Thumbnail for version as of 04:06, 28 September 2024768 × 576 (185 KB)Mrfebruary (talk | contribs)update
04:22, 15 January 2024Thumbnail for version as of 04:22, 15 January 2024720 × 540 (186 KB)Mrfebruary (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata