在R标记中绘制图形

在R标记中绘制图形,r,graphics,r-markdown,R,Graphics,R Markdown,我一直在使用R标记来重现R代码,并报告一些数据处理。在绘图方面,输出到RStudio IDE的内容与通过html中的knitr呈现的内容之间存在差异。以下是适用于这两种情况的代码 barplot(top10summariseDamage$totalDamage, names.arg = c('Hurricane Opal','Heavy Rain/Severe Weather', 'Tornadoes, TSTM Wind, Hai

我一直在使用R标记来重现R代码,并报告一些数据处理。在绘图方面,输出到RStudio IDE的内容与通过html中的knitr呈现的内容之间存在差异。以下是适用于这两种情况的代码

barplot(top10summariseDamage$totalDamage, 
        names.arg = c('Hurricane Opal','Heavy Rain/Severe Weather', 
                      'Tornadoes, TSTM Wind, Hail', 'Severe Thunderstorm',
                      'Wild Fires', 'Hail Storm', 'Major Flood',
                      'Hurricane Opal/High Winds', 'Winter Storm/High Winds',
                      'Record Cold'), 
        ylim = c(0, 5*10^10), las = 2, ylab = 'Dollars Damage ($)', 
        main = "Economic Damage by Event Type") 
以下是正在绘制的向量的dput,为了更加清晰,我在数字中添加了逗号

c(31728479000, 2.5e+10, 16000002500, 12053600200,  6.241e+09, 
 2.41e+09, 1.05e+09, 1000010000,  600005000,  5.6e+08)
在RStudio中,哪一个正确生成了以下内容 如您所见,最左侧的条小于4e10。但是,当我使用knitr生成html报告时,会呈现以下内容


正如您所看到的,尽管我将y轴增加了10倍,但条形图的值实际上偏离了比例。非常感谢您的帮助。

请您使用
dput()
提供您的数据。您好,Martin,我已经在绘图函数调用下面添加了dput日期,为了清晰起见,我在其中添加了逗号。最高值为2.5e10,ylim=c(0,5*10^10)。我还尝试将5*10^10更改为5e10,但html的输出是相同的。Stackoverflow不允许我编辑自己的评论。”“dput date”应为“dput data”,我无法重现您的问题。“也许您在绘图之前设置了任何图形选项。@Martin。它与knit->html过程有关。你有什么建议吗?