⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_plotfig.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
📖 第 1 页 / 共 2 页
字号:
function fig = fm_plotfig()
% FM_PLOTFIG create GUI for plotting variables
%
% FM_PLOTFIG()
%
%Author:    Federico Milano
%Date:      11-Nov-2002
%Update:    27-Feb-2003
%Update:    11-Sep-2003
%Version:   1.0.2
%
%E-mail:    fmilano@thunderbox.uwaterloo.ca
%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano

global Fig Varname DAE Bus Syn Settings Theme Path Snapshot Hdl

if isempty(Varname.bus),
  fm_disp('No loaded system',2),
  return,
end
if Fig.plot,
  figure(Fig.plot)
  fm_plot('initlist')
  fm_plot('initxlabel')
  fm_plot('listvars')
  return
end

load finger

Settings.zoom = '';
colori2= [ 1.0000    1.0000    0.5000;
           1.0000    0.5000    1.0000;
           0.5000    1.0000    1.0000;
           0.5000    0.5000    1.0000;
           0.5000    1.0000    0.5000;
           1.0000    0.5000    0.5000;
           0.7000    0.7000    0.7000];

tipiplot = {'Standard Colors'; 'Black and White'; 'Black Numbers'; ...
            'Black Symbols';   'Colors & Symbols'; 'Colors & Numbers'};

%SSize = get(0,'ScreenSize');
%Sratio = SSize(3)/SSize(4);

Varname.po = [];

h0 = figure('Color',Theme.color01, ...
            'Units', 'normalized', ...
            'Colormap',[], ...
            'CreateFcn','Fig.plot = gcf;', ...
            'DeleteFcn','Fig.plot = 0;', ...
            'FileName','fm_plotfig', ...
            'MenuBar','none', ...
            'Name','PSAT Plot', ...
            'NumberTitle','off', ...
            'PaperPosition',[18 180 576 432], ...
            'PaperType','A4', ...
            'PaperUnits','points', ...
            'PointerShapeCData',finger, ...
            'Position',sizefig(0.7,0.7), ...
            'Resize','on', ...
            'ToolBar','none');
fm_set colormap

% Axes
% --------------------------------------------------------------------------
h1 = axes('Parent',h0, ...
          'CreateFcn','Hdl.axeslogo = gca;', ...
          'Box','on', ...
          'CameraUpVector',[0 1 0], ...
          'CameraUpVectorMode','manual', ...
          'Color',Theme.color11, ...
          'ColorOrder',colori2, ...
          'HandleVisibility','on', ...
          'HitTest','off', ...
          'Layer','top', ...
          'Position',[0.09 0.0663 0.23 0.23], ...
          'Tag','Axes2', ...
          'XColor',Theme.color03, ...
          'XLim',[0.5 200.5], ...
          'XLimMode','manual', ...
          'XTickLabelMode','manual', ...
          'XTickMode','manual', ...
          'YColor',Theme.color03, ...
          'YDir','reverse', ...
          'YLim',[0.5 150.5], ...
          'YLimMode','manual', ...
          'YTickLabelMode','manual', ...
          'YTickMode','manual', ...
          'ZColor',[0 0 0]);
if ispc, set(gca,'XColor',[126 157 185]/255,'YColor',[126 157 185]/255), end

set(h0,'Units','pixels')
figdim = get(h0,'Position');
set(h0,'Units','normalized')
xd = round(figdim(3)*0.23);
yd = round(figdim(4)*0.23);

fractalimg = ['alhambra',int2str(round(rand*8))];
main_logo = 0; %round(rand);
if main_logo
  a = fm_mat('main_logo');
else
  a = imread([Path.images,fractalimg,'.jpg'],'jpg');
end
try
  a = imresize(a,[yd xd],'bilinear',11);
catch
  % imresize is not available!!!
end

h2 = image('Parent',h1, ...
           'CData',a, ...
           'Tag','Axes2Image1', ...
           'XData',[1 200], ...
           'YData',[1 150]);

% PSAT name, version and date in the left-bottom picture
if main_logo
  color1 = [0 0 0];
  color2 = [0 0.503 0];
  if sum(Theme.color02) < 1
    color1 = [1 1 1];
    color2 = [0 1 0];
  end

  h1 = text(15,40,'PSAT');
  set(h1, ...
      'Color',color1, ...
      'FontSize',12, ...
      'FontWeight','bold', ...
      'FontName','Times')
  h1 = text(15,140,Settings.date);
  set(h1, ...
      'Color',color2, ...
      'FontSize', 9, ...
      'FontWeight','bold', ...
      'FontName','Times')
  h1 = text(15,120,['Version ',Settings.version]);
  set(h1, ...
      'Color',color2, ...
      'FontSize', 9, ...
      'FontWeight','bold', ...
      'FontName','Times')
end

% Axes for plots
h1 = axes('Parent',h0, ...
          'CreateFcn','Hdl.axesplot = gca;', ...
          'Box','on', ...
          'CameraUpVector',[0 1 0], ...
          'CameraUpVectorMode','manual', ...
          'Color',Theme.color04, ...
          'ColorOrder',Settings.color, ...
          'FontName',Theme.font01, ...
          'FontSize',12, ...
          'Position',[0.09 0.4050 0.4754 0.5000], ...
          'Tag','Axes1', ...
          'XColor',[0 0 0], ...
          'XLimMode','manual', ...
          'YColor',[0 0 0], ...
          'YLimMode','manual', ...
          'ZColor',[0 0 0]);

if isunix, set(h1,'FontSize',10), end

% Menu File
h1 = uimenu('Parent',h0, ...
	    'Label','File', ...
	    'Tag','MenuFile');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot exporttext', ...
	    'Label','Export data as plain text', ...
	    'Tag','PushText', ...
	    'Accelerator','p');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot exportmtv', ...
	    'Label','Export data as MTV plot file', ...
	    'Tag','PushText', ...
	    'Accelerator','v');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot exportscript', ...
	    'Label','Export data as Matlab script', ...
	    'Tag','PushText', ...
	    'Accelerator','s');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot export', ...
	    'Label','Export data as Color EPS', ...
	    'Tag','PushEPS', ...
	    'Accelerator','e');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot export', ...
	    'Label','Export data as Metafile', ...
	    'Tag','PushMeta', ...
	    'Accelerator','m');
if isunix, set(h2,'Enable','off'), end
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot export', ...
	    'Label','Export data as Matlab Figure', ...
	    'Tag','PushFig', ...
	    'Accelerator','f');
h2 = uimenu('Parent',h1, ...
	    'Callback','close(gcf)', ...
	    'Label','Exit', ...
	    'Tag','NetSett', ...
	    'Accelerator','x', ...
	    'Separator','on');

% Menu Plot
h1 = uimenu('Parent',h0, ...
	    'Label','Plot', ...
	    'Tag','MenuPlot');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot plotvars', ...
	    'Label','Plot graph', ...
	    'Tag','PushPlot', ...
	    'Accelerator','z');

% Menu Legend
h1 = uimenu('Parent',h0, ...
	    'Label','Legend', ...
	    'Tag','MenuLegend');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot togglelegend', ...
	    'Label','Legend on/off', ...
	    'Tag','PushLegend', ...
	    'Accelerator','l');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot moveup', ...
	    'Label','Move up name', ...
	    'Tag','PushPlot', ...
	    'Separator', 'on', ...
	    'Accelerator','u');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot movedown', ...
	    'Label','Move down name', ...
	    'Tag','PushPlot', ...
	    'Accelerator','d');
h2 = uimenu('Parent',h1, ...
	    'Callback','fm_plot editvarname', ...
	    'Label','Edit legend name', ...
	    'Tag','PushPlot', ...
	    'Accelerator','t');

% Listboxes
% ----------------------------------------------------------------------
h1 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color03, ...
               'Callback','fm_plot listvars', ...
               'CreateFcn','fm_plot initlist', ...
               'FontName',Theme.font01, ...
               'ForegroundColor',Theme.color10, ...
               'Max',20, ...
               'Position',[0.6047  0.5070  0.1624  0.4043], ...
               'Style','listbox', ...
               'Tag','Listbox1', ...
               'Value',[]);

string = ['if strcmp(get(Fig.plot,''SelectionType''),', ...
          '''open''), fm_plot(''editvarname''), end'];
h1 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color03, ...
               'Callback',string, ...
               'FontName',Theme.font01, ...
               'ForegroundColor',Theme.color06, ...
               'Position',[0.80291  0.64679  0.15789  0.26453], ...
               'Style','listbox', ...
               'Tag','Listbox2', ...
               'Value',1);

% Push buttons for editing the plotted variables
h1 = uicontrol('Parent',h0, ...
               'CData',fm_mat('plot_arrowup'), ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color02, ...
               'Callback','fm_plot moveup', ...
               'Position',[0.80291      0.5948    0.052632    0.044343], ...
               'TooltipString','Move Variable Up', ...
               'Tag','Pushbutton13');
h1 = uicontrol('Parent',h0, ...
               'CData',fm_mat('plot_arrowdown'), ...
               'Units', 'normalized', ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -