我正在markdown文件中生成一些图形,但是该图形在html文件中看起来不正确。
在RStudio中,它运行良好,看起来像这样:
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9XeVVNUS5qcGcifQ==” alt =“ R中的图”>
但是在markdown html文件中,右侧的图例框被切除:
>中的图>
我尝试调整fig.width
,fig.align
,fig.show='asis'
,fig.crop
。他们要么没有做任何更改,要么只是使整个图看起来更窄,而图例框仍不完整。
有没有办法使它在markdown html文件中看起来正常?
我正在markdown文件中生成一些图形,但是该图形在html文件中看起来不正确。在RStudio中,它运行良好,看起来像这样:但是在markdown html文件中,...
我在Rmarkdown html报告中也遇到了这个问题,我通过更改ggplot2中的图边距来解决它:theme(plot.margin = unit(c(1,2,1,1),“ cm”))。第二个“单位”数字从1增加到2,以保留右侧的图例。我在这里找到了这个答案:ggplot2: Exclude legend from aspect ratio