R/Polygons

From QERM Wiki
Revision as of 00:33, 9 May 2008 by Ian (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Converting polygon into R

There may be better ways to do this, but I know this way works.

Get Inkscape, a free, open source vector graphics editor, http://www.inkscape.org/, and open a figure from which you'd like to grab an image. In Inkscape, select the image with the selection tool and go to pulldown menu Path > Trace Bitmap. Play around until you get something decent. Multiple colors can be much more challenging than converting a single object that does not overlap other things. In some cases, it might be easier to clean up the image in GIMP or some other graphics editor first.

Now play around with your paths, perhaps using the Object > Ungroup (shift + ctrl + G) or the Path > Break Apart (shift + ctrl + K) commands until you have only what you want to import to R.

Now save as type "LaTeX with PStricks macros (*.tex)." and edit that text file (probably using find and replace) to get just the numbers, separated by commas or whatever.

Read the vector of numbers into R and arrange into a 2 by N matrix.

...to be continued...

Personal tools