0

I have a complex task: to merge existing SVG image with barplots in R. I want to save the output file as a vector graphics as well. So I create the layout, in one of the subplots I create the barplot and now:
How can I load an existing SVG from the hard drive and then put it into the plot? I have tried grimport and grimport2 libraries but they fail to read my SVG. How should I prepare it? It is a simple sketch made in Inkscape, should I save it in any special way?
I'd prefer to use a library that is supported by Anaconda Cloud.

EDIT:

I menaged to read the .ps file with grimport and convert it to a picture object - it was crashing previously because I had a text box with non-standard font in the SVG and the library could not ready that properly (some encoding problems).

Now I am just looking for a way to put the Picture object on the layout, just as if I would use plot(runif(10), runif(10)) to have a scatterplot

Community
  • 1
  • 1
maciek
  • 1,807
  • 2
  • 18
  • 30
  • does [THIS](https://www.r-bloggers.com/plot-the-new-svg-r-logo-with-ggplot2/) help? – Andre Elrico Apr 09 '18 at 15:07
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Do you get errors or some kind when you read your files? What exactly goes wrong? – MrFlick Apr 09 '18 at 15:17
  • @AndreElrico - not really, – maciek Apr 09 '18 at 15:34
  • @MrFlick - there is no sample input and output since this is not a specific question, please look at the edit I made. – maciek Apr 09 '18 at 15:35

1 Answers1

0
grid.picture(picture_object[-1],x=x_coord,y=y_coord)

With the variables x_coord and y_coord I can manipulate the position of the image.

maciek
  • 1,807
  • 2
  • 18
  • 30