<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468</link>
    <title>MATLAB Central Newsreader - Density scatter plots in Matlab</title>
    <description>Feed for thread: Density scatter plots in Matlab</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 14 Jul 2008 00:55:03 -0400</pubDate>
      <title>Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442728</link>
      <author>Andrew </author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I am new to Matlab, and I am wondering if someone here can &lt;br&gt;
help me with scatter plots.  &lt;br&gt;
&lt;br&gt;
I have some code that computes some energies, etc., and I &lt;br&gt;
created a simple scatter plot of a dependent variable &lt;br&gt;
versus an independent variable.  The code is partially &lt;br&gt;
random in parts.&lt;br&gt;
&lt;br&gt;
If I create a scatter plot and tell my function to plot a &lt;br&gt;
large number of data points--100,000, for example--the &lt;br&gt;
points are all plotted, but since there are so many, the &lt;br&gt;
scatter plot becomes in most areas of the plot just a &lt;br&gt;
solid colored blob.  Only at the edges of the plot can I &lt;br&gt;
see individual points, because the code is written such &lt;br&gt;
that there is low probability of having a point along &lt;br&gt;
these &quot;fringes.&quot;&lt;br&gt;
&lt;br&gt;
One way to avoid this solid colored blob of a scatter plot &lt;br&gt;
would be to take less data points.  However, because of &lt;br&gt;
the way my code works, I do not want to do this.  &lt;br&gt;
&lt;br&gt;
What I would really like is a scatter plot that is colored &lt;br&gt;
coded.  A certain color would correspond to a certain &lt;br&gt;
range of numbers of points that are in a certain area of &lt;br&gt;
the plot.  In other words, I would like to make a color &lt;br&gt;
coded &quot;density&quot; plot.  &lt;br&gt;
&lt;br&gt;
I can't seem to find a way to do this in the documentation &lt;br&gt;
for the scatter command.  &lt;br&gt;
&lt;br&gt;
Do you know if there is a way to create such color coded &lt;br&gt;
density plots?&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 01:17:01 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442729</link>
      <author>matt dash</author>
      <description>&quot;Andrew &quot; &amp;lt;rearwindow1954@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g5e857$pml$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am new to Matlab, and I am wondering if someone here can &lt;br&gt;
&amp;gt; help me with scatter plots.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have some code that computes some energies, etc., and I &lt;br&gt;
&amp;gt; created a simple scatter plot of a dependent variable &lt;br&gt;
&amp;gt; versus an independent variable.  The code is partially &lt;br&gt;
&amp;gt; random in parts.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If I create a scatter plot and tell my function to plot a &lt;br&gt;
&amp;gt; large number of data points--100,000, for example--the &lt;br&gt;
&amp;gt; points are all plotted, but since there are so many, the &lt;br&gt;
&amp;gt; scatter plot becomes in most areas of the plot just a &lt;br&gt;
&amp;gt; solid colored blob.  Only at the edges of the plot can I &lt;br&gt;
&amp;gt; see individual points, because the code is written such &lt;br&gt;
&amp;gt; that there is low probability of having a point along &lt;br&gt;
&amp;gt; these &quot;fringes.&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; One way to avoid this solid colored blob of a scatter plot &lt;br&gt;
&amp;gt; would be to take less data points.  However, because of &lt;br&gt;
&amp;gt; the way my code works, I do not want to do this.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What I would really like is a scatter plot that is colored &lt;br&gt;
&amp;gt; coded.  A certain color would correspond to a certain &lt;br&gt;
&amp;gt; range of numbers of points that are in a certain area of &lt;br&gt;
&amp;gt; the plot.  In other words, I would like to make a color &lt;br&gt;
&amp;gt; coded &quot;density&quot; plot.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can't seem to find a way to do this in the documentation &lt;br&gt;
&amp;gt; for the scatter command.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Do you know if there is a way to create such color coded &lt;br&gt;
&amp;gt; density plots?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
&lt;br&gt;
I'm pretty sure there's a file on the file exchange that&lt;br&gt;
does this, but I'm not sure how well it works with really&lt;br&gt;
big data sets. Here's what i like to do: randomly choose 80%&lt;br&gt;
of your points, plot them in a light color. Choose another&lt;br&gt;
10%, plot them in a darker shade. Choose another 6%, plot&lt;br&gt;
them in an even darker shade. Plot the rest of the points in&lt;br&gt;
the darkest shade. &lt;br&gt;
&lt;br&gt;
If this doesnt make sense, just try it and see. It's not&lt;br&gt;
&quot;exact&quot; but its very quick and easy and will show the&lt;br&gt;
interior pattern. (It looks even better on a black&lt;br&gt;
background, plotting from dark to light)</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 14:25:23 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442824</link>
      <author>Peter Perkins</author>
      <description>matt dash wrote:&lt;br&gt;
&amp;gt; &quot;Andrew &quot; &amp;lt;rearwindow1954@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;g5e857$pml$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; What I would really like is a scatter plot that is colored &lt;br&gt;
&amp;gt;&amp;gt; coded.  A certain color would correspond to a certain &lt;br&gt;
&amp;gt;&amp;gt; range of numbers of points that are in a certain area of &lt;br&gt;
&amp;gt;&amp;gt; the plot.  In other words, I would like to make a color &lt;br&gt;
&amp;gt;&amp;gt; coded &quot;density&quot; plot.  &lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I can't seem to find a way to do this in the documentation &lt;br&gt;
&amp;gt;&amp;gt; for the scatter command.  &lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Do you know if there is a way to create such color coded &lt;br&gt;
&amp;gt;&amp;gt; density plots?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'm pretty sure there's a file on the file exchange that&lt;br&gt;
&amp;gt; does this&lt;br&gt;
&lt;br&gt;
This may be what Matt is referring to:&lt;br&gt;
&lt;br&gt;
&amp;lt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13352&amp;objectType=file&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13352&amp;objectType=file&lt;/a&gt;&amp;gt;</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 15:13:03 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442837</link>
      <author>Ken Garrard</author>
      <description>Peter Perkins &amp;lt;Peter.PerkinsRemoveThis@mathworks.com&amp;gt; wrote &lt;br&gt;
in message &amp;lt;g5fnkj$rkc$2@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; matt dash wrote:&lt;br&gt;
&amp;gt; &amp;gt; &quot;Andrew &quot; &amp;lt;rearwindow1954@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g5e857$pml$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; What I would really like is a scatter plot that is &lt;br&gt;
colored &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; coded.  A certain color would correspond to a certain &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; range of numbers of points that are in a certain area &lt;br&gt;
of &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; the plot.  In other words, I would like to make a &lt;br&gt;
color &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; coded &quot;density&quot; plot.  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; I can't seem to find a way to do this in the &lt;br&gt;
documentation &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; for the scatter command.  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Do you know if there is a way to create such color &lt;br&gt;
coded &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; density plots?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I'm pretty sure there's a file on the file exchange that&lt;br&gt;
&amp;gt; &amp;gt; does this&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This may be what Matt is referring to:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;lt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
loadFile.do?objectId=13352&amp;objectType=file&amp;gt;&lt;br&gt;
&lt;br&gt;
Or try plot3k, which I takes about 3 secs to plot the peaks &lt;br&gt;
function with 1001x1001 data points.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/&lt;/a&gt;&lt;br&gt;
loadFile.do?objectId=9519&amp;objectType=file&lt;br&gt;
&lt;br&gt;
Ken</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 16:12:02 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442864</link>
      <author>Andrew </author>
      <description>Peter Perkins &amp;lt;Peter.PerkinsRemoveThis@mathworks.com&amp;gt; &lt;br&gt;
wrote in message &amp;lt;g5fnkj$rkc$2@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; matt dash wrote:&lt;br&gt;
&amp;gt; &amp;gt; &quot;Andrew &quot; &amp;lt;rearwindow1954@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;g5e857$pml$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; What I would really like is a scatter plot that is &lt;br&gt;
colored &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; coded.  A certain color would correspond to a certain &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; range of numbers of points that are in a certain area &lt;br&gt;
of &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; the plot.  In other words, I would like to make a &lt;br&gt;
color &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; coded &quot;density&quot; plot.  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; I can't seem to find a way to do this in the &lt;br&gt;
documentation &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; for the scatter command.  &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Do you know if there is a way to create such color &lt;br&gt;
coded &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; density plots?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Thanks.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I'm pretty sure there's a file on the file exchange &lt;br&gt;
that&lt;br&gt;
&amp;gt; &amp;gt; does this&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This may be what Matt is referring to:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;lt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFi&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFi&lt;/a&gt;&lt;br&gt;
le.do?objectId=13352&amp;objectType=file&amp;gt;&lt;br&gt;
&lt;br&gt;
Peter Perkins,&lt;br&gt;
&lt;br&gt;
Thanks so much for the link!  The code looks very &lt;br&gt;
helpful.  One question, though: is it just me, or does it &lt;br&gt;
seem like the third axis of the plot is always on the &lt;br&gt;
order of 10^(-3), no matter how many data points I include &lt;br&gt;
on the plot?  For example, if you just run the sample code &lt;br&gt;
given in the file, the height of the &quot;peak&quot; is &lt;br&gt;
approximately 0.95*10^(-3).  Do you know why this is so?&lt;br&gt;
&lt;br&gt;
Again, thank you SO much for your help.  It really helps &lt;br&gt;
me out.&lt;br&gt;
&lt;br&gt;
Best Wishes, &lt;br&gt;
&lt;br&gt;
Andrew</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 16:55:18 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442887</link>
      <author>Peter Perkins</author>
      <description>Andrew wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; One question, though: is it just me, or does it &lt;br&gt;
&amp;gt; seem like the third axis of the plot is always on the &lt;br&gt;
&amp;gt; order of 10^(-3), no matter how many data points I include &lt;br&gt;
&amp;gt; on the plot?  For example, if you just run the sample code &lt;br&gt;
&amp;gt; given in the file, the height of the &quot;peak&quot; is &lt;br&gt;
&amp;gt; approximately 0.95*10^(-3).  Do you know why this is so?&lt;br&gt;
&lt;br&gt;
Well, it's a density plot, so regardless of how much data you have, the surface &lt;br&gt;
has to integrate to 1.  I suspect that's what you're seeing.  I can only refer &lt;br&gt;
you to the cited paper for details of the plot.</description>
    </item>
    <item>
      <pubDate>Mon, 14 Jul 2008 17:40:19 -0400</pubDate>
      <title>Re: Density scatter plots in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/172468#442905</link>
      <author>matt dash</author>
      <description>Yep that's the file i was talking about. Although you might&lt;br&gt;
still want to try the method I suggested if knowing the&lt;br&gt;
exact point locations is important (like if the exact shape&lt;br&gt;
of the boundary matters, ie knowing where you go from having&lt;br&gt;
sparse data to zero data). If you're working with something&lt;br&gt;
like normal distributions this doesn't matter since in&lt;br&gt;
theory there is no boundary, but if you're using bounded&lt;br&gt;
distributions there is a definate boundary. With the FEX&lt;br&gt;
solutions you get smoother density coloration, but any small&lt;br&gt;
structures like this in your data get smoothed out. </description>
    </item>
  </channel>
</rss>

