📄 dsblayout.m
字号:
function dsblayout
% This function will layout the gui controls. Eventually, this will be
% included in the complete function. Just have it now for simplicity.
% First get the user data from the root. See if anything is stored there.
% H.fig Handle to the GUI figure window
% H.plots Handles to plot windows created with this GUI
% POLAR SMOOTH
% H.smooth Handle to edit box for the loess smoothing parameter
% H.degree Handle to edit box for the degree of polynomial
% H.dimpol Handle to edit box for dimensions to display in loess - could be a vector of them
% H.robflag Handle to radio button. If selected, do a robust smooth
% BIVARIATE HISTOGRAMS
% H.band Handle to edit box for histogram bandwidths
% H.dimhist Handle to edit box for dimensions to display in bivariate histograms
% HEXAGONAL BINNING
% H.bins Handle to edit box for number of bins in hexagonal binning
% H.dimhex Handle to edit box for dimensions to display in hexagonal binning
ud = get(0,'userdata');
% 'position',[150 150 726 524],...
H.fig = figure('Tag','bivgui',...
'units','characters',...
'position',[21 6 144 42],...
'resize','off',...
'toolbar','none',...
'menubar','none',...
'numbertitle','off',...
'name','Distribution Shapes - Bivariate GUI',...
'CloseRequestFcn','bivgui(''close'')');
if strcmp(version('-release'),'14')
set(0,'DefaultUicontrolFontname','Sans Serif');
end
% Keep track of GUI plots in this array. So, we can close when the gui is
% closed.
H.plots = [];
if ~isempty(ud)
% Then something is there already. Add necessary handles to the
% structure.
ud.guis = [ud.guis(:); H.fig];
else
% Set the usual stuff and save in root.
ud = userdata;
set(0,'userdata',ud)
end
%%%%%%% FRAMES %%%%%%%%%%%%%%%
% set up all of the frames first.
uicontrol(H.fig, 'style','frame',...
'position',[21 306 680 140]);
uicontrol(H.fig, 'style','frame',...
'position',[21 160 680 140]);
uicontrol(H.fig, 'style','frame',...
'position',[21 15 680 140]);
%%%%%%% TEXT BOXES %%%%%%%%%%%%%%
% set up all of the text boxes
uicontrol(H.fig,'style','text',...
'position',[170 485 330 27],...
'fontweight','bold',...
'fontsize',14,...
'backgroundcolor',[.8 .8 .8],...
'string','Distribution Shapes - Bivariate')
% Title boxes
uicontrol(H.fig,'style','text',...
'position',[40 405 70 34],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Polar Smooths')
uicontrol(H.fig,'style','text',...
'position',[40 270 70 17],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Histograms')
uicontrol(H.fig,'style','text',...
'position',[40 115 75 34],...
'fontweight','bold',...
'fontsize',10,...
'horizontalalignment','left',...
'string','Hexagonal Binning')
% Instruction text boxes:
uicontrol(H.fig,'style','text',...
'position',[150 408 540 30],...
'horizontalalignment','left',...
'string','Produces a bivariate scatterplot smooth for each of the specified columns of the data matrix')
uicontrol(H.fig,'style','text',...
'position',[150 260 540 30],...
'horizontalalignment','left',...
'string','Produces a histogram for each of the specified columns of the data matrix.')
uicontrol(H.fig,'style','text',...
'position',[150 95 540 50],...
'horizontalalignment','left',...
'string','Produces a scatterplot with hexagonal binning for each of the specified columns of the data matrix.')
uicontrol(H.fig,'style','text',...
'position',[150 450 450 35],...
'horizontalalignment','left',...
'backgroundcolor',[.8 .8 .8],...
'string','Works on two columns (variables or dimensions) of the data matrix. Use these capabilities to explore the bivariate distribution characteristics of your variables.')
% Steps - text in frame 1
uicontrol(H.fig,'style','text',...
'position',[40 355 120 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Enter smoothing parameter:')
% uicontrol(H.fig,'style','text',...
% 'units','characters',...
% 'position',[7.842 26.385 20.326 2.462],...
% 'fontname','times new roman',...
% 'fontsize',9,...
% 'horizontalalignment','left',...
% 'string','1. Enter smoothing parameter:')
uicontrol(H.fig,'style','text',...
'position',[150 355 312 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter degree of polynomial:')
uicontrol(H.fig,'style','text',...
'position',[320 355 200 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Enter dimensions to display, separated by commas, or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 355 150 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','4. Push button to display:')
% Steps - text in frame 2
uicontrol(H.fig,'style','text',...
'position',[40 220 230 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Enter number of bins:')
uicontrol(H.fig,'style','text',...
'position',[286 219 260 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter dimensions to display, separated by commas, or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 235 150 16],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Push button to display:')
% Steps - text in frame 3
uicontrol(H.fig,'style','text',...
'position',[40 65 230 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','1. Enter number of bins:')
uicontrol(H.fig,'style','text',...
'position',[203 65 312 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','2. Enter dimensions to display, separated by commas, or enter ''all'':')
uicontrol(H.fig,'style','text',...
'position',[550 65 150 32],...
'fontsize',9,...
'horizontalalignment','left',...
'string','3. Push button to display:')
%%%%%%% BUTTONS %%%%%%%%%%%%%%%%%%%%
uicontrol(H.fig,'style','pushbutton',...
'position',[14 491 88 23],...
'string','LOAD DATA',...
'tooltipstring','This will bring up the Load Data GUI',...
'callback','loadgui')
uicontrol(H.fig,'style','pushbutton',...
'position',[14 463 88 23],...
'string','TRANSFORM',...
'tooltipstring','This will bring up the Transform Data GUI.',...
'callback','transformgui')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 330 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display scatterplots with polar smooths.',...
'callback','bivgui(''polarplot'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 190 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display the bivariate histograms.',...
'callback','bivgui(''disphist'')')
uicontrol(H.fig,'style','pushbutton',...
'position',[555 43 100 25],...
'string','DISPLAY PLOT',...
'tooltipstring','This will display the scatterplots with hexagonal binning.',...
'callback','bivgui(''hexplot'')')
% Close button
uicontrol(H.fig,'style','pushbutton',...
'position',[620 485 66 25],...
'string','CLOSE',...
'callback','bivgui(''close'')',...
'tooltipstring','Push this button to close the GUI window.')
%%%%%% EDIT BOXES %%%%%%%%%%%%%%%%%%%%%%
% First frame
H.smooth = uicontrol('style','edit',...
'string','0.5',...
'position',[40 330 82 22],...
'backgroundcolor','white');
H.degree = uicontrol('style','edit',...
'string','2',...
'position',[150 330 82 22],...
'backgroundcolor','white');
H.dimpol = uicontrol('style','edit',...
'string','all',...
'position',[320 330 82 22],...
'backgroundcolor','white');
% Second Frame
% The following is the bandwidth edit box. The default will be the normal
% reference rule for each dimension - then taking the average.
H.band = uicontrol('style','edit',...
'string','10',...
'position',[40 190 175 22],...
'backgroundcolor','white');
H.dimhist = uicontrol('style','edit',...
'string','all',...
'position',[286 190 82 22],...
'backgroundcolor','white');
% Third Frame
H.bins = uicontrol('style','edit',...
'string','10',...
'position',[40 43 82 22],...
'backgroundcolor','white');
H.dimhex = uicontrol('style','edit',...
'string','all',...
'position',[286 43 82 22],...
'backgroundcolor','white');
%%%%%%%% RADIO BUTTON %%%%%%%%%%%%%%%%
H.robflag = uicontrol('style','radio',...
'position',[150 390 540 30],...
'max',1,'min',0,...
'String','Select to do a robust smooth.');
% Save Handles for THIS GUI in the UserData for this figure.
set(gcf,'userdata',H)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -