Skip to content

Drawing a dotted circle.

13 messages · arun, Jose Iparraguirre, Ben Bolker +6 more

#
HI Ved,

I was able to get the dotted circle using the same command.? I am using R 2.15 on Ubuntu 12.04.
A.K.? 




----- Original Message -----
From: Ved P. Sharma <vedsharma at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Saturday, January 12, 2013 2:43 AM
Subject: [R] Drawing a dotted circle.

Hi,

I am trying to draw a dotted circle by using symbols command:

symbols(0, 0, circles = 1, inches = FALSE, fg = 'gray', lty=2)

But it gives me a solid line. I was just wondering whether am I making a
mistake?

Ved

??? [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
Ved P. Sharma <vedsharma <at> gmail.com> writes:
Works for me (although it's a dashed line; lty=3 gives a dotted
line) on Ubuntu 10.04, R-devel.  Results of sessionInfo() please?
#
Hi Arun,

Thanks for your reply.

I am running R 2.15.2 (32-bit) on Windows 7. Please take a look at the
attached image of the circle, which does not look dotted to me. I also
tried it on RStudio and it gives the same result, i.e. solid line.

Ved
On Sat, Jan 12, 2013 at 11:43 AM, arun <smartpink111 at yahoo.com> wrote:
#
Don't know, but you can use the function draw.circle in the plotrix package.
Hope this helps,
Jose
#
Hello,

Checks ok on Ubuntu 12.04 but not on Windows 7, where it plots a solid 
line circle.

symbols(0, 0, circles = 1, inches = FALSE, fg = 'gray', lty=2)
sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

loaded via a namespace (and not attached):
[1] tools_2.15.2


Hope this helps,

Rui Barradas
Em 12-01-2013 17:02, Ben Bolker escreveu:
#
A wild guess which I can't check right now, but: is there something
funny/different with the Windows graphics driver that draws the result
of a dashed line based on many closely spaced points as a solid line?
i.e., it draws a dash for the beginning of every segment within the
line, even if they are close together, resulting in overlapping dashes
-> a solid line?  Don't have time to dig into

.External.graphics(C_symbols, x, y, type, data,
        inches, bg, fg, ...)

 right now ...
On 13-01-12 01:41 PM, Rui Barradas wrote:
#
Hello,

In Windows it's

.Internal(symbols(x, y, type, data, inches, bg, fg, ...))

And this is what I've found:
file r-2.15.2\src\main\graphics.c
function GSymbol

     /*
      * Force line type LTY_SOLID
      * i.e., current par(lty) is ignored when drawing symbols
      */
     gc.lty = LTY_SOLID;


So, the op is out of luck, lty solid is hard-coded in the C source.
Maybe plotrix::draw.circle, like Jose suggested.

Rui Barradas
Em 12-01-2013 18:53, Ben Bolker escreveu:
#
You can get a dashed line if you plot to pdf() or svg(), but not any of the
bitmap devices. The ellipse() function in the car package will work, but you
have to set up the plot first:

library(car)
plot(c(-1.1, 1.1), c(-1.1, 1.1), type="n", asp=1)
ellipse(c(0, 0), matrix(c(1,0,0,1), 2), 1, lty=2, co="gray", center.pch="")

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
#
Thanks everyone for suggesting the alternative draw.circle.

Ved

On Sat, Jan 12, 2013 at 12:50 PM, Jose Iparraguirre
<Jose.Iparraguirre at ageuk.org.uk> wrote:
#
On 01/12/2013 06:43 PM, Ved P. Sharma wrote:
Hi Ved,
You can draw circles on a plot using the draw.circle (plotrix) function. 
If the problem is the method of drawing broken lines as suggested by Ben 
Bolker, you may be able to get broken lines on Windows by using smaller 
values in the "nv" argument. By decreasing the number of line segments 
used to draw the circle, the breaks should appear.

Jim
2 days later