Home > cellorganizer > utilities > niceplot.m

niceplot

PURPOSE ^

NICEPLOT Helper function to plot something that is readable and savable in a new figure window.

SYNOPSIS ^

function H = niceplot(xval,yval,xlabelstr,ylabelstr,titlestr,plottype,plotstyle)

DESCRIPTION ^

NICEPLOT Helper function to plot something that is readable and savable in a new figure window.

Inputs:

 xval = vector of x values 
 yval = vector of y values
 xlabelstr = string for name of the x variable
 ylabelstr = string for name of the y variable
 titlestr = optional string to label the figure with a title
 plottype = string of plot type (scatter,plot,semilogx,semilogy,loglog)
 plotstyle = string e.g. '.' or '-B'

Outputs:
 h = figure handle

Author: Devin Sullivan 6/17/13

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function H = niceplot(xval,yval,xlabelstr,ylabelstr,titlestr,plottype,plotstyle)
0002 %NICEPLOT Helper function to plot something that is readable and savable in a new figure window.
0003 %
0004 %Inputs:
0005 %
0006 % xval = vector of x values
0007 % yval = vector of y values
0008 % xlabelstr = string for name of the x variable
0009 % ylabelstr = string for name of the y variable
0010 % titlestr = optional string to label the figure with a title
0011 % plottype = string of plot type (scatter,plot,semilogx,semilogy,loglog)
0012 % plotstyle = string e.g. '.' or '-B'
0013 %
0014 %Outputs:
0015 % h = figure handle
0016 %
0017 %Author: Devin Sullivan 6/17/13
0018 
0019 % Copyright (C) 2007-2013  Murphy Lab
0020 % Carnegie Mellon University
0021 %
0022 % This program is free software; you can redistribute it and/or modify
0023 % it under the terms of the GNU General Public License as published
0024 % by the Free Software Foundation; either version 2 of the License,
0025 % or (at your option) any later version.
0026 %
0027 % This program is distributed in the hope that it will be useful, but
0028 % WITHOUT ANY WARRANTY; without even the implied warranty of
0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0030 % General Public License for more details.
0031 %
0032 % You should have received a copy of the GNU General Public License
0033 % along with this program; if not, write to the Free Software
0034 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0035 % 02110-1301, USA.
0036 %
0037 % For additional information visit http://murphylab.web.cmu.edu or
0038 % send email to murphy@cmu.edu
0039 
0040 
0041 if nargin<7
0042     plotstyle = '.';
0043 elseif nargin==5
0044     plotstyle = '.';
0045     plottype = 'scatter';
0046 elseif nargin==4
0047     plotstyle = '.';
0048     plottype = 'scatter';
0049     titlestr = '';
0050 end
0051 
0052 
0053 switch plottype
0054 
0055     case 'scatter'
0056         figure,scatter(xval,yval,100,plotstyle);
0057     case 'plot'
0058         figure,plot(xval,yval,plotstyle,'Linewidth',2,'MarkerSize',20);
0059     case 'semilogx'
0060         figure,semilogx(xval,yval,plotstyle,'Linewidth',2,'MarkerSize',20);
0061     case 'semilogy'
0062         figure,semilogy(xval,yval,plotstyle,'Linewidth',2,'MarkerSize',20);
0063     case 'loglog'
0064         figure,loglog(xval,yval,plotstyle,'Linewidth',2,'MarkerSize',20);
0065     otherwise
0066         disp('Sorry, unrecognized plot type');
0067         return
0068 end
0069 title(titlestr,'FontSize',20,'Fontname','Ariel')
0070 xlabel(xlabelstr,'FontSize',20,'Fontname','Ariel');
0071 ylabel(ylabelstr,'FontSize',20,'Fontname','Ariel');

Generated on Sun 29-Sep-2013 18:44:06 by m2html © 2005