Sun Jun 14 14:20:05 MDT 2020

```You're right, they are not closed contours. I forced them closed through

xib = new( (/2*nbins/), "double")
yib = new( (/2*nbins/), "double")
...
xib(0) = xib(2*nbins-1)
yib(0) = yib(2*nbins-1)

Thanks a lot Dave! I'll be presenting this plot at cesm workshop on
wednesday if you're curious of what it means.

On Sun, Jun 14, 2020 at 8:18 AM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Very nice plots.  Notice how those mystery lines fade as they approach
> (0,0).  That is because they are polygons, not lines.  Specifically, long
> skinny triangles.  That is a clue.
>
> xib and yib are not closed contours.  I am not sure whether
> gsn_add_polygon is supposed to close them for you.  But since this seems to
> coincide with the visible anomalies, try closing them explicitly.
>
>     xib = new( (/2*nbins+1/), "double")
>     yib = new( (/2*nbins+1/), "double")
>     ...
>     xib(2*nbins) = xib(0)
>     yib(2*nbins) = yib(0)
>
>
> On Fri, Jun 12, 2020 at 7:59 PM Adam Herrington via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> 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.
>>
>> 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.
>>
>> **digression before I go on to details on my primary issue**
>> I'd like to experiment with an actual violin plot, with a smoothed kernel
>> density estimate of the distribution. The routine kde_n_test
>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/kde_n_test.shtml> should
>> work, but the warnings on the ncl page say the function is under
>> construction. Is that the latest update for this function?
>> **end digression**
>>
>> 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.
>>
>>   dx = 0.4d0 ;; x-depth of the pdf
>>   xvals = (/1.,2.,3.,4.,5.,6./) ;; case id
>> ...
>>     pdfib = pdfx(ibdiff,nbins,optpdf)
>>     pdfib = pdfib/max(pdfib)
>>
>>     xib = new( (/2*nbins/), "double")
>>     yib = new( (/2*nbins/), "double")
>>
>>     xib(0:nbins-1) = xvals(n) - dx*pdfib
>>     xib(nbins:2*nbins-1) = xvals(n) + dx*pdfib(nbins-1:0)
>>     yib(0:nbins-1) = pdfib at bin_center
>>     yib(nbins:2*nbins-1) = pdfib at bin_center(nbins-1:0)
>>
>>     pgstr = unique_string("dum")
>>
>> 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
>>
>> thanks,