Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Density scatter plots in Matlab
Date: Mon, 14 Jul 2008 01:17:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 51
Message-ID: <g5e9ed$8k$1@fred.mathworks.com>
References: <g5e857$pml$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1215998221 276 172.30.248.35 (14 Jul 2008 01:17:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 14 Jul 2008 01:17:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 939004
Xref: news.mathworks.com comp.soft-sys.matlab:479083



"Andrew " <rearwindow1954@yahoo.com> wrote in message
<g5e857$pml$1@fred.mathworks.com>...
> Hello,
> 
> I am new to Matlab, and I am wondering if someone here can 
> help me with scatter plots.  
> 
> I have some code that computes some energies, etc., and I 
> created a simple scatter plot of a dependent variable 
> versus an independent variable.  The code is partially 
> random in parts.
> 
> If I create a scatter plot and tell my function to plot a 
> large number of data points--100,000, for example--the 
> points are all plotted, but since there are so many, the 
> scatter plot becomes in most areas of the plot just a 
> solid colored blob.  Only at the edges of the plot can I 
> see individual points, because the code is written such 
> that there is low probability of having a point along 
> these "fringes."
> 
> One way to avoid this solid colored blob of a scatter plot 
> would be to take less data points.  However, because of 
> the way my code works, I do not want to do this.  
> 
> What I would really like is a scatter plot that is colored 
> coded.  A certain color would correspond to a certain 
> range of numbers of points that are in a certain area of 
> the plot.  In other words, I would like to make a color 
> coded "density" plot.  
> 
> I can't seem to find a way to do this in the documentation 
> for the scatter command.  
> 
> Do you know if there is a way to create such color coded 
> density plots?
> 
> Thanks.

I'm pretty sure there's a file on the file exchange that
does this, but I'm not sure how well it works with really
big data sets. Here's what i like to do: randomly choose 80%
of your points, plot them in a light color. Choose another
10%, plot them in a darker shade. Choose another 6%, plot
them in an even darker shade. Plot the rest of the points in
the darkest shade. 

If this doesnt make sense, just try it and see. It's not
"exact" but its very quick and easy and will show the
interior pattern. (It looks even better on a black
background, plotting from dark to light)