<div dir="ltr">I'm attempting to compute a raw violin-type plot. This is similar to a box plot, but I'm drawing a polygon around the pdf, and I close the polygon through a mirror image (-1*probability). Then I rotate it so it's vertical, and align it with the x-axis "id" of the box plot.<div><br></div><div>If you're not following, I don't blame you ... this is hard to describe. Attached is my attempt at this that will hopefully clarify what I'm trying to do.</div><div><br></div><div>**digression before I go on to details on my primary issue**</div><div>I'd like to experiment with an actual violin plot, with a smoothed kernel density estimate of the distribution. The routine <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/kde_n_test.shtml">kde_n_test</a> should work, but the warnings on the ncl page say the function is under construction. Is that the latest update for this function?</div><div>**end digression**</div><div><br></div><div>You'll notice for panels 2 and 3 there is a line pivoting from the bottom of the pdf's to the (0,0) point on the plot. I'm having trouble tracking down why this occurs and how to fix it. I'm going to copy-paste the relevant portions of the code for one of the x-value id's.</div><div><br></div><div>  dx = 0.4d0 ;; x-depth of the pdf<br>  xvals = (/1.,2.,3.,4.,5.,6./) ;; case id<br></div><div>...</div><div>    pdfib = pdfx(ibdiff,nbins,optpdf)<br>    pdfib = pdfib/max(pdfib)<br><br>    xib = new( (/2*nbins/), "double")<br>    yib = new( (/2*nbins/), "double")<br><br>    xib(0:nbins-1) = xvals(n) - dx*pdfib<br>    xib(nbins:2*nbins-1) = xvals(n) + dx*pdfib(nbins-1:0)<br>    yib(0:nbins-1) = pdfib@bin_center<br>    yib(nbins:2*nbins-1) = pdfib@bin_center(nbins-1:0)<br></div><div><br></div><div>    pgstr = unique_string("dum")<br>    plot@$pgstr$ = gsn_add_polygon(wks,plot(0),xib,yib,respg)<br></div><div><br></div><div>I am pretty sure the xib and yib are a closed contour.. they go from 0:nbins-1 and then nbins:2*nbins-1 ... Would like to get another set of eyes on this though</div><div><br></div><div>thanks,</div><div>Adam</div><div><br></div><div><br></div><div><br></div></div>