我正在尝试自定义由以下人员生成的剧情:
plot(irf(VECMcoeff, n.ahead = 20, cumulative = FALSE, ortho = TRUE))
当前数字:
尚未发布数字。
有没有一种使用R的基础绘图功能来调整此绘图的方法?更具体地说;
感谢您的帮助!
数据:
dput(head(combined,25))
structure(c(3.12378036948822, 3.24514490963516, 2.54231015523096,
3.10758964326189, 3.26905177146087, 3.39086921629928, 3.39867627597089,
3.063339608249, 2.82158440194456, 3.00060851536641, 2.87498214357332,
2.73447964251719, 2.51961774067125, 2.43535838893541, 2.53536474393679,
2.11458263713232, 2.08443293370433, 1.70951997715485, 1.6939353104687,
1.99402766681289, 2.17851574489578, 2.02035721460859, 2.19849725222166,
2.12385225312224, 2.13870052300126, 2.53563259854902, 2.71236841778707,
2.80602806173539, 2.44978220282482, 2.22240349195674, 2.6269002941349,
2.55424892433652, 2.84227347851153, 3.00695212249206, 2.56409065301929,
2.11958065079056, 1.93021828518557, 1.91149187923047, 2.12824458610721,
1.99034383037538, 1.85993728242216, 1.78831122085649, 1.70508421574581,
1.34148894168009, 1.26428948883955, 1.53707667916106, 1.40125321322403,
1.56189928398736, 1.59267901471992, 1.29435444758231, 2.88357952825106,
3.2967949657277, 2.71315870827614, 2.88194083947586, 2.55384396254808,
2.48162552588286, 2.43461752858767, 2.60895931242784, 2.88699097436266,
3.06774759389068, 2.92820858177705, 1.9236817467793, 1.30469143981917,
1.63412478606386, 1.32569634585868, 1.66411340281953, 1.811114177636,
1.32324449480086, 0.683740288067047, 0.506428412402278, 0.244160570695116,
-0.0614637978267916, 0.11100051693192, 0.107431188637327, -0.0946163941762501,
1.56887584570782, 2.2953989716194, 2.3913948824343, 1.60366568545365,
2.14074303245166, 1.42821783272864, 1.14416900596202, 1.32550310805691,
1.06775704738626, 1.1754985484452, 1.30819594680082, 1.57801107586324,
1.57465869540119, 1.52953051921855, 1.59632502092932, 1.51164066108273,
1.74699133577352, 1.89513403376172, 1.50403737650093, 1.69077755145674,
1.51619819345532, 1.7908456553931, 1.63120428277988, 1.72264300428443,
1.91016040082409, 2.93953881174612, 0.573867521584496, 1.36693966408554,
1.33745582274447, 2.00217541671565, 1.47500074486359, 1.54892810099376,
1.52596101747453, 1.85097710190023, 1.8027452973638, 1.71255671138078,
1.78801314649281, 1.73039561596535, 1.7797925346833, 1.68662137367852,
2.10887254895115, 2.47630376444312, 2.10728662380876, 1.99939507617536,
2.1661652656972, 1.97780409080129, 2.08116163569287, 2.33934227442197,
2.38773088163046, 2.39899888596041), .Dim = c(25L, 5L), .Dimnames = list(
NULL, c("rstar.nl2", "rstar.ger2", "rstar.fr2", "rstar.sp2",
"rstar.it2")))
答案 0 :(得分:0)
一些一般建议:
plot()
是一个泛型函数,实际上根据要绘制的内容调用更特定的函数(称为“方法”)(请参阅Hadley Wickham的 Advanced R中的this章) 书以获取详细信息)。在这种情况下,您需要将“ varirf”类的对象提供给plot()
。您可以通过运行例如
out <- irf(your_arguments_go_here)
class(out)
通用函数plot()
正在调用方法plot.varirf()
,因为您要输入“ varirf”类型的对象。要查看您可以控制plot.varirf()
的哪些参数,请查看该功能的帮助页面
?plot.varirf
如果这不能使您完全控制所需的绘图,则应放弃尝试使用plot.varif()
并手动构建所需的绘图,如:
plot(x=my_x_vals, y=my_y_vals, main="My Title", pch=20, col="red", etc.)
在手动创建绘图时,您可能会发现查看plot.varirf
绘图的创建方式很有用,因此可以实现某些相同的格式。要查看plot.varirf
的源代码,请使用:
getAnywhere(plot.varirf)
答案 1 :(得分:0)
这里是一个例子:
plot(x, plot.type = "single", names = NULL, main = "IRF to a one-standard deviation shock to APP", sub = NULL, lty = NULL, lwd = NULL, col = NULL, ylim = NULL, ylab = "Eonia", xlab = "Number of periods", mar.multi = c(0, 4, 0, 4), oma.multi = c(6, 4, 6, 4), adj.mtext = NA, padj.mtext = NA, col.mtext = NA)
其中,x是您的varest对象,
祝你好运!