Home > GLMdenoise > utilities > scattersparse.m

scattersparse

PURPOSE ^

function h = scattersparse(x,y,num,wanttitle,markersize,markercolor,marker)

SYNOPSIS ^

function h = scattersparse(x,y,num,wanttitle,markersize,markercolor,marker)

DESCRIPTION ^

 function h = scattersparse(x,y,num,wanttitle,markersize,markercolor,marker)

 <x>,<y> are matrices of same size
 <num> (optional) is the number of points to show.  default: 1000.
 <wanttitle> (optional) is whether to change the title.  default: 1.
 <markersize> (optional).  default: 16.
 <markercolor> (optional).  default: 'r'.
   can also be a matrix the same size as <x> and <y>.
 <marker> (optional).  default: '.'.

 in existing figure window (if any), scatter plot <x> against <y>,
 with a maximum of <num> points shown.  this routine is deterministic
 in which points are (randomly) picked.  return the handles.

 example:
 figure; scattersparse(randn(1,1000),randn(1,1000),100,1);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = scattersparse(x,y,num,wanttitle,markersize,markercolor,marker)
0002 
0003 % function h = scattersparse(x,y,num,wanttitle,markersize,markercolor,marker)
0004 %
0005 % <x>,<y> are matrices of same size
0006 % <num> (optional) is the number of points to show.  default: 1000.
0007 % <wanttitle> (optional) is whether to change the title.  default: 1.
0008 % <markersize> (optional).  default: 16.
0009 % <markercolor> (optional).  default: 'r'.
0010 %   can also be a matrix the same size as <x> and <y>.
0011 % <marker> (optional).  default: '.'.
0012 %
0013 % in existing figure window (if any), scatter plot <x> against <y>,
0014 % with a maximum of <num> points shown.  this routine is deterministic
0015 % in which points are (randomly) picked.  return the handles.
0016 %
0017 % example:
0018 % figure; scattersparse(randn(1,1000),randn(1,1000),100,1);
0019 
0020 % deal with input
0021 if ~exist('num','var') || isempty(num)
0022   num = 1000;
0023 end
0024 if ~exist('wanttitle','var') || isempty(wanttitle)
0025   wanttitle = 1;
0026 end
0027 if ~exist('markersize','var') || isempty(markersize)
0028   markersize = 16;
0029 end
0030 if ~exist('markercolor','var') || isempty(markercolor)
0031   markercolor = 'r';
0032 end
0033 if ~exist('marker','var') || isempty(marker)
0034   marker = '.';
0035 end
0036 
0037 % figure out which ones
0038 [xtemp,idx] = picksubset(x,num);
0039 ytemp = y(idx);
0040 if ~ischar(markercolor)
0041   markercolor = markercolor(idx);
0042 end
0043 
0044 % do it
0045 h = scatter(xtemp,ytemp,markersize,markercolor,marker);
0046 if wanttitle
0047   title(sprintf('showing %.2f percent',length(xtemp)/length(x(:))*100));
0048 end

Generated on Fri 01-Aug-2014 12:03:17 by m2html © 2005