Skip to content
Prev 8949 / 63421 Next

"trace" argument in legend() (PR#2578)

Full_Name: Jerome Asselin
Version: 1.6.2
OS: RedHat Linux 7.2
Submission from: (NULL) (142.103.173.179)



Should be an easy fix...

Consider the examble below:

plot(0,0)
legend(0,0,c("Hello!","Hi!"),pch=1:2,lty=1:2,trace=T)

It gives the following trace:
xchar= 0.05178 ; (yextra,ychar)= 0 0.07941
  rect2(0,0, w=0.3474, h=0.2382...)
  segments2(0.015540.01554,-0.07941-0.1588, dx=0.1036, dy=0, ...)
  points2( 0.06732 0.06732 , -0.07941 -0.1588 , pch= 1 2 ...)

On the line starting by "segment2", the coordinates are not separated
by a space like on the line starting by "points2".

My recommendation is to remove the option `sep = ""' in this part of
code in legend().

[...]
        if (trace)
            catn("  segments2(", xt[ok.l] + x.off * xchar, ",",
                yt[ok.l], ", dx=", seg.len * xchar, ", dy=0, ...)",
                sep = "")
[...]

Sincerely,
Jerome Asselin