[ncl-talk] Density Scatter Plot

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri Aug 16 16:32:10 MDT 2019


The following approach should make an approximation of your sample plot.

1.  Compute a local density score for each point in your scatter plot.  For
a first try, simply loop through all the points.  For each point, count the
number of other points within overlapping distance in X/Y plot space from
the current point.  My initial guess on the distance would be 1/2 marker
diameter, i.e. 1 radius, but perhaps a little larger.  This will need a
little experimentation.

2.  Make the scatter plot in the usual way, except color each marker
according to its density score.  Start by selecting a color scale similar
to that sample plot.

Caveat, use only solid color markers.  If your markers have fixed color
outlines, a normal feature of some NCL markers, the outline color will
defeat this density coloring scheme.  If you are stuck with dual colored
markers, just make the outline color the same as the interior.

--Dave


On Fri, Aug 16, 2019 at 4:13 PM MELISSA KAZEMI RAD via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hi Rick,
>
> I don't have any problem  plotting the scatter plot or changing the
> translucency of the points. However, it doesn't have the desired visual
> effect that I want, plus I am asked to overlay a heatmap contour plot of
> the density of the point by journal reviewer, and that's what I couldn't
> figure out how to do.
>
>  I appreciate your help.
>
> Melissa
>
> On Fri, Aug 16, 2019 at 5:26 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi Melissa,
>>
>> You might try making the markers somewhat translucent to reduce their
>> overall visual impact.See the resource gsMarkerOpacityF at:
>>
>> http://ncl.ucar.edu/Document/Graphics/Resources/gs.shtml
>>
>> I might start with a value of 0.5 and decrease or increase to get the
>> right effect.
>>
>> Hope that helps...
>> Rick
>>
>> On Fri, Aug 16, 2019 at 2:48 PM MELISSA KAZEMI RAD via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>>> Hi,
>>>
>>> I'd like to overlay a contour over a scatter plot that reflects density
>>> of respective data points, something like a heatmap. The scatter plot that
>>> I have is so dense that it's almost impossible to have a sense of how
>>> scattered the data points actually are.
>>> I looked for examples, but none were what I am looking for. I am looking
>>> for something like the attached plot.
>>>
>>> Thanks,
>>> Melissa
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190816/0c9596e0/attachment.html>


More information about the ncl-talk mailing list