📄 da_hist.m
字号:
%
% da_2dsc
%
% Programme for plotting 2D scatter graphs
%
% Sort the screen out
%
da_front;
drawnow;
ax1=axes(...
'Units','pixels',...
'Position',[50 150 500 250],...
'Box','on',...
'Color',[0 0 0],...
'Visible','on');
Xlabel('Value');
Ylabel('Frequency');
%
% Print a title
%
text1=da_text(w1,190,405,250,15,'Histogram Plot',[1 1 1],[1 0 0]);
old_val1=1;
sl1_value=1;
[dummy num_pcs]=size(data);
%
% Plot the histogram
%
hist(data(:,sl1_value),20);
%
% Have a slider to change which pc to plot
%
sl1=uicontrol(w1,...
'Style','slider',...
'Position',[50 60 200 20],...
'Min',1,...
'Max',num_pcs,...
'Value',1,...
'CallBack',[
'set(sl1_current,''String'',ceil(get(sl1,''Value'')));',...
'sl1_value=ceil(get(sl1,''Value''));',...
'if sl1_value ~= old_val1;',...
'set(sl1_current,''String'',num2str(ceil(sl1_value)));',...
'hist(data(:,sl1_value),ceil(get(sl2,''value'')));',...
'old_val1=sl1_value;',...
'Xlabel(''Value'');',...
'Ylabel(''Frequency'');',...
'end;']);
sl1_current=uicontrol(w1,...
'Style','text',...
'Position',[225 85 20 15],...
'BackGroundColor',[0 0 0],...
'ForeGroundColor',[1 1 1],...
'String',num2str(get(sl1,'Value')));
sl1_min=uicontrol(w1,...
'Style','text',...
'Position',[30 60 15 15],...
'BackGroundColor',[0 0 0],...
'ForeGroundColor',[1 1 1],...
'String','1');
sl1_max=uicontrol(w1,...
'Style','text',...
'Position',[250 60 20 15],...
'BackGroundColor',[0 0 0],...
'ForeGroundColor',[1 1 1],...
'String',num2str(num_pcs));
sl1_title=uicontrol(w1,...
'Style','text',...
'Position',[45 85 180 15],...
'BackGroundColor',[0 0 0],...
'ForeGroundColor',[1 1 1],...
'String','Select an input variable:');
%
% Draw a slider to determine the "bin" size
%
sl2=uicontrol(w1,...
'style','slider',...
'position',[375 60 150 20],...
'min',1,...
'max',100,...
'value',25,...
'callback',[
'set(sl2_current,''string'',num2str(ceil(get(sl2,''value''))));',...
'hist(data(:,ceil(get(sl1,''value''))),ceil(get(sl2,''value'')));',...
'Xlabel(''Value'');',...
'Ylabel(''Frequency'');']);
sl2_title=da_text(w1,340,80,165,15,'Select the number of bins:',[1 1 1],[0 0 0]);
sl2_min=da_text(w1,350,60,15,15,'1',[1 1 1],[0 0 0]);
sl2_max=da_text(w1,530,60,20,15,'100',[1 1 1],[0 0 0]);
sl2_current=da_text(w1,510,80,20,15,num2str(ceil(get(sl2,'value'))),[1 1 1],[0 0 0]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -