<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot display the Plot from R on splunk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110866#M1646</link>
    <description>&lt;P&gt;You are correct, it's not possible to use the R plot function to display charts in Splunk.&lt;/P&gt;

&lt;P&gt;So you need to output data to Splunk (you've already done that) and pipe the data to a chart command. Like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| r "..." | chart ...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;See documentation of the chart commend &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/chart"&gt;here&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/Viz/Visualizationreference"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;The screenshot you posted shows four plotted charts. I think the Splunk chart command supports only one chart. To display fours charts at the some time, you need to create a dashboard containing fours panels each contains one chart. See documentation about creating dashboards &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/Viz/CreateandeditdashboardsviatheUI"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I don't know what kind of math function you use to plot those kind of charts and I don't know if there is a equivalent function/command to create charts that looks the same. Maybe have a look at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/ListOfSearchCommands"&gt;list of supported commands&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jun 2014 12:09:32 GMT</pubDate>
    <dc:creator>rfujara_splunk</dc:creator>
    <dc:date>2014-06-20T12:09:32Z</dc:date>
    <item>
      <title>Cannot display the Plot from R on splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110865#M1645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have integrated "r" (splunk app) with R and i am trying to run the following script&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;beta_binom&amp;lt;-function(n,y,a=1,b=1,main="")
{
    #likelihood: y|theta~binom(n,theta)
    #prior: theta~beta(a,b)
    #posterior: theta|y~beta(a+y,n-y+b)

theta&amp;lt;-seq(0.001,0.999,0.001)
prior&amp;lt;-dbeta(theta,a,b)
if(n&amp;gt;0){likelihood&amp;lt;-dbinom(rep(y,length(theta)),n,theta)}
if(n&amp;gt;0){posterior&amp;lt;-dbeta(theta,a+y,n-y+b)}

#standardize!
prior&amp;lt;-prior/sum(prior)
if(n&amp;gt;0){likelihood&amp;lt;-likelihood/sum(likelihood)}
if(n&amp;gt;0){posterior&amp;lt;-posterior/sum(posterior)}

ylim&amp;lt;-c(0,max(prior))
if(n&amp;gt;0){ylim&amp;lt;-c(0,max(c(prior,likelihood,posterior)))}

plot(theta,prior,type="l",lty=2,xlab="theta",ylab="",main=main,ylim=ylim)
if(n&amp;gt;0){lines(theta,likelihood,lty=3)}
if(n&amp;gt;0){lines(theta,posterior,lty=1,lwd=2)}
legend("topright",c("prior","likelihood","posterior"),
       lty=c(2,3,1),lwd=c(1,1,2),inset=0.01,cex=.5)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;The plot is working fine on R , but we are unable to figure how to get the plot on Splunk via 'r' splunk app.&lt;/P&gt;

&lt;P&gt;We executed the following command on splunk after uploading the above script using the example given on the app &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| r "
source('trial1.r')
result = beta_binom(4,2,5,10,"")
output = data.frame(Result=c(result))
"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and we got following output&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/1_3.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/2_2.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;and the same script when run on R, it gives following output, please help&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/R.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jun 2014 09:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110865#M1645</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2014-06-19T09:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot display the Plot from R on splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110866#M1646</link>
      <description>&lt;P&gt;You are correct, it's not possible to use the R plot function to display charts in Splunk.&lt;/P&gt;

&lt;P&gt;So you need to output data to Splunk (you've already done that) and pipe the data to a chart command. Like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| r "..." | chart ...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;See documentation of the chart commend &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/chart"&gt;here&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/Viz/Visualizationreference"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;The screenshot you posted shows four plotted charts. I think the Splunk chart command supports only one chart. To display fours charts at the some time, you need to create a dashboard containing fours panels each contains one chart. See documentation about creating dashboards &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/Viz/CreateandeditdashboardsviatheUI"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I don't know what kind of math function you use to plot those kind of charts and I don't know if there is a equivalent function/command to create charts that looks the same. Maybe have a look at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/ListOfSearchCommands"&gt;list of supported commands&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jun 2014 12:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110866#M1646</guid>
      <dc:creator>rfujara_splunk</dc:creator>
      <dc:date>2014-06-20T12:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot display the Plot from R on splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110867#M1647</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| r "
 source('trial1.r')
 result = beta_binom(4,2,5,10,"");
 output = data.frame(Result=c(result))
 "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;just use ; delimiter before the output command.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2015 05:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Cannot-display-the-Plot-from-R-on-splunk/m-p/110867#M1647</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-07-02T05:12:38Z</dc:date>
    </item>
  </channel>
</rss>

