invalid line type: must be length 2, 4, 6 or 8

plot, r

Solution

You can fix it by reading `?par`:

Line types can either be specified by giving an index into a small built-in table of line types (1 = solid, 2 = dashed, etc, see lty above) or directly as the lengths of on/off stretches of line. This is done with a string of an even number (up to eight) of characters, namely non-zero (hexadecimal) digits which give the lengths in consecutive positions in the string. For example, the string "33" specifies three units on followed by three off and "3313" specifies three units on followed by three off followed by one on and finally three off. The ‘units’ here are (on most devices) proportional to lwd, and with lwd = 1 are in pixels or points or 1/96 inch.

So, passing a character to `lty` doesn't mean what you thought. You probably just meant `lty = 1`.

Problem

I am using segments for drawing line but i need little bit more control on line type. SO I am using lty="1" but i get error message. I am using code below. ``` segments(593, 20.65+.06, 593+3, 20.65+.06, col= "black", lty="1") ``` But i am getting following error message. ``` Error in segments(593, 20.65 + 0.06, 593 + 3, 20.65 + 0.06, col = "black", : invalid line type: must be length 2, 4, 6 or 8 ``` I just need to control line type mentioned in lty().How can i fix this problem?

Original source