[英]Changing length of lines in a legend
The following simple example... 以下简单示例......
plot(c(1,2),c(1,2),type="l")
legend(1,1.5,legend="Test",lty=1,seg.len=2)
...produces the error ...产生错误
Error in legend(1, 1.5, legend = "Test", lty = 1, seg.len = 2) : unused argument (seg.len = 2)
How should I use seg.len
to get longer lines in legends? 我应该如何使用
seg.len
在传说中获得更长的线条?
If you use this in a larger script, other packages might mask the legend()
function. 如果在较大的脚本中使用它,其他包可能会掩盖
legend()
函数。 These "other" functions might not contain the seg.len
parameter. 这些“其他”函数可能不包含
seg.len
参数。 Thus you have to reference to the basic legend
function. 因此,您必须参考基本
legend
功能。 You can easily achieve this by adding the package like this: 您可以通过添加如下包来轻松实现此目的:
graphics::legend(1, 1.5, legend = "Test", lty = 1, seg.len = 2)
The code in question works perfectly for me (see image output below). 有问题的代码对我来说非常适合(参见下面的图像输出)。
I suggest you do the following: 我建议你做以下事情:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.