The OP's question might be interpreted as "draw the R logo in R", meaning base R graphics. This interpretation excludes packages like rsvg that use a rendering engine such as https://wiki.gnome.org/Projects/LibRsvg (the R here is for "Resplendent SVG", not the R language).
Thanks to Barry for describing the approach. Using Barry's email as context, I asked Cursor to write R code to parse Rlogo.svg and make a plot with base R graphics. It took a few debugging iterations to get a working script, and gradients currently aren't working. The only CRAN package used in the script is xml2. Chat history and code are here: https://github.com/jedick/R-svg-interpreter Code to generate Rlogo.png, assuming Rlogo.svg is in the current directory: source("svg_interpreter.R") savePlot("Rlogo.png") Jeff On Mon, Jun 30, 2025 at 4:23 PM Barry Rowlingson <b.rowling...@lancaster.ac.uk> wrote: > > The SVG isn't that complex, it defines two colour gradients (one for the R > and one for the ring) and then draws each one using a series of cubic > bezier curves and lines > > These are in <path> tags in the SVG which look like this: > > M361.453,485.937 C162.329,485.937 0.906,377.828 0.906,244.469 > C0.906,111....etc > > M is "move to" and then "C" defines a curve, "L" defines a straight line I > don't think any other path items are used. > > There's two paths, each being two parts because both the R and the ring > have holes in them. > > If you want to draw this from scratch in R code, first write (or find) > code to draw cubic bezier curves as per the SVG spec, then extract the > coordinates from the path attributes in the SVG then make polygons and > shade them using the colour gradients at the start of the SVG... > > Barry > > > > On Sun, Jun 29, 2025 at 9:34 PM Hasan Diwan <hasan.di...@gmail.com> wrote: > > > This email originated outside the University. Check before clicking links > > or attachments. > > > > Rajan, > > https://hasan.d8u.us/Rlogo.svg Best I could do in a pinch. -- H > > > > > On 6/27/2025 12:16 PM, Ranjan Maitra via R-help wrote: > > > >> Hi, > > > >> > > > >> Is there code for drawing the R logo? https://www.r-project.org/logo/ > > > has the logo in svg and png formats, and also > > > >> the terms of the license, but I can not find code to draw this. > > > > -- > > OpenPGP: https://hasan.d8u.us/openpgp.asc > > If you wish to request my time, please do so using > > *https://bit.ly/hd1Appointment > > <https://bit.ly/hd1Appointment>*. > > Si vous voudriez faire connnaisance, allez a * > > https://bit.ly/hd1Appointment > > <https://bit.ly/hd1Appointment>*. > > > > <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1 > > >Sent > > from my mobile device > > Envoye de mon portable > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > https://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.