[R] Drawing a dotted circle.
David L Carlson
dcarlson at tamu.edu
Sat Jan 12 21:44:07 CET 2013
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:
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
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rui Barradas
> Sent: Saturday, January 12, 2013 1:21 PM
> To: Ben Bolker
> Cc: r-help at stat.math.ethz.ch; vedsharma at gmail.com
> Subject: Re: [R] Drawing a dotted circle.
> 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:
> > A wild guess which I can't check right now, but: is there
> > funny/different with the Windows graphics driver that draws the
> > 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
> > -> 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,
> >> Checks ok on Ubuntu 12.04 but not on Windows 7, where it plots a
> >> 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:
> >>  LC_COLLATE=Portuguese_Portugal.1252
> >>  LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
> >>  LC_TIME=Portuguese_Portugal.1252
> >> attached base packages:
> >>  stats graphics grDevices utils datasets methods base
> >> loaded via a namespace (and not attached):
> >>  tools_2.15.2
> >> Hope this helps,
> >> Rui Barradas
> >> Em 12-01-2013 17:02, Ben Bolker escreveu:
> >>> Ved P. Sharma <vedsharma <at> gmail.com> writes:
> >>>> 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?
> >>> 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?
> >>> ______________________________________________
> >>> 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.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help