我试图在R中绘制一个条形图,将其保存到PNG文件,然后再绘制一些东西,并再次保存。到目前为止,我的尝试以错误plot.new has not been called yet
结束。对应的代码是将绘图保存到图像上,然后在绘图上绘制其他线条并再次保存。
# Draw without lines
png(c(name, '.png'), width=480, height=240);
stripchart(data, pch=4, method='jitter');
dev.off();
# Draw with with lines
png(c(name, '_with_trim_points', '.png'), width=480, height=240);
abline(v=points, untf = FALSE, col='red');
abline(v=more__points, untf = FALSE, col='green')
dev.off();
只需调用stripchart(data, pch=4, method='jitter');
第二时间是不是一种选择,因为抖动将是不同的,并用一个不同的散点图中结束。
你能提供一个可重现的例子(包括数据)吗?更易于修改代码。 – Heroka
看看'dev.copy()',最后有一些例子可能有所帮助。 – drmariod
或者 - 随着抖动随机生成 - 设置种子,并在创建新图之前重置它。 – Heroka