This is my plot
This is my code so far for the plot
#From 2004 to 2019, Canada, Buildings--#
x = (2004:2019)
y = integer(19)
y = as.double(y)
len = dim(Buildings)[1]
rng = (1:len)
for (i in rng) {
idx = strtoi(Buildings[i,2]) - 2000
y[idx] = y[idx] + as.double(Buildings[i,77])
}
y=y[04:19]
matplot(x, y, type="b", lty=4, pch = 18, col="blue",xlab="Year",
ylab="Total Emission",main = "Building Sector 2004-2019", lwd = '3')
pettittTest <- trend::pettitt.test(x = Buildings[['TotalEmi']])
print(pettittTest)
print(Buildings[['Year']][pettittTest$estimate])
Thanks in advance
We need a reproducible example (reprex)
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
Any particular reason for using matplot?
When I try this
x = (2004:2019)
y = integer(19)
y = as.double(y)
y=y[04:19]
matplot(x, y, type="b", lty=4, pch = 18, col="blue",xlab="Year",
ylab="Total Emission",main = "Building Sector 2004-2019", lwd = '3')
all I get is a flat line with y == 0
system
Closed
January 12, 2022, 6:13pm
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.