Has anyone figured out how to render a plot using sp_execute_external_script where the plot is returned in the SQL Management Studio result window or the message window or a popup window? I was able to output a plot to the file system but that is not ideal.
Below is how I got a plot to output to the file system.
EXECUTE sp_execute_external_script
@language = N'R'
, @script = N' trellis.device(device="png", filename="c:/output/HistPlot.png");
myHist=histogram(~col1, data=InputDataSet);
print(myHist)'
, @input_data_1 = N'SELECT col1, col2 from ds.dbo.[sample]'
Until Microsoft provide visualization capability, you could use SSMSBoost which is a free utility that could solve your problem.
Once installed, please highlight the cell with the binary picture to be read. Right click and select Visualize as and then choose picture.

The image is going to be displayed into Paint:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With