I have got a huge problem with the R Snippet node and KNIME 3.1. The output of my node is a SVG file, which worked perfectly fine until KNIME 3.0.1. Now the same workflow, same node, same R code outputs a SVG file with just an empty container. True story! Please help!
Here is what the output looks like:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="720pt" height="360pt" viewBox="0 0 720 360" version="1.1">
I am aware of this RServe issue, but I have RServe installed and the node pretends to work fine. Even the Validate Script option shows no anomalies.
thank you for reporting, I am currently working on this. Could you please mention what operating system including architecture (32/64 bit) you are working on.
R code outputs a SVG file with just an empty container
Do I understand correctly, that you are creating the SVG as a string in R and outputing that string?
I am working on Windows 7 Professional SP-1 (64 Bit). The R version is 3.2.2 and, as mentioned above, I have RServe installed.
The node/snippet writes a SVG plot to disk and returns the correspondend URL on its outport.
I just prepared a workflow for you. If you can provide me with an email address, I can send the workflow to you (I don't want to upload the workflow here).
I sent you an email to the adress you provided for your forum account. You may attach the workflow in an answer.
Thank you in advance!
first of all, thank you for the workflow, I was able to find/solve the problem. I am answering here, since it may be interesting to other users.
You are using ggplot to draw a plot onto the SVG device. These plots need to be printed to actually appear on the device. The reason this worked before is that our previous method of executing R code printed every individual command, just as R does, too, and I believe it should be so for the nodes aswell.
I was able to get your workflow running by calling print on the result of the ggplot() call:
I hope that is okay for now, solving the problem on the KNIME R Integration side will probably take a while. Maybe some day, you will even be able to create the SVG directly from R as image output.
Hope that helps.
Thank you very much for your help, I have been playing around for some hours and finally found a very simple and convenient solution:
We can use ggsave for saving our ggplot2 plots instead of using the Cairo package/functions.
This works very well and I wouldn't even call it a "workaround". Furthermore it leads me to think that it is not a ggplot2 specific issue, but a Cairo issue?!
If you are interested, I can provide you with the updated workflow via email.