📄 fm_plot.m
字号:
nomefile = fm_filenum('eps'); print(Fig.plot,'-depsc',[Path.data,nomefile]) set(hdlfig,'Position',axs_pos); set(hdlfig2,'Position',ax2_pos); set(Fig.plot,'Position',fig_pos) set(Fig.plot,'PaperPosition',pap_pos) if Settings.hostver > 5.3, set(Fig.plot,'PaperSize',pap_siz) end set(Hdl_all,'Visible','on'); if leg_value set(Hdl.legend,'Position',pos_leg); end case 'PushMeta' print(Fig.plot,'-dmeta') set(hdlfig,'Position',axs_pos); set(hdlfig2,'Position',ax2_pos); set(Fig.plot,'Position',fig_pos) set(Fig.plot,'PaperPosition',pap_pos) if Settings.hostver > 5.3, set(Fig.plot,'PaperSize',pap_siz) end set(Hdl_all,'Visible','on'); if leg_value set(Hdl.legend,'Position',pos_leg); end case 'PushFig' figplot = Fig.plot; Fig.plot = 0; set(figplot, ... 'Position',[0.2265 0.2265 0.5469 0.5469], ... 'Menubar','figure', ... 'Name','', ... 'NumberTitle','on', ... 'CreateFcn','', ... 'DeleteFcn','', ... 'UserData',[], ... 'FileName','') set(Hdl.axesplot,'Color',[1 1 1]) if leg_value set(Hdl.legend,'Color',[1 1 1]) end delete(Hdl_all) delete(hdlfig2) fm_plotfig figure(figplot) end if ~isempty(lastwarn) & ~strcmp(lastwarn,'File not found or permission denied') fm_disp(lastwarn,2), end warning on case 'plottypes' tipoplot = get(Hdl_tipoplot,'Value'); switch tipoplot case 1, set(Fig.plot, ... 'DefaultAxesColorOrder',Settings.color, ... 'DefaultAxesLineStyle','-'); case 2, set(Fig.plot, ... 'DefaultAxesColorOrder',[ 0 0 0 ], ... 'DefaultAxesLineStyleOrder','-|-.|--|:'); case 3, set(Fig.plot, ... 'DefaultAxesColorOrder',[ 0 0 0 ], ... 'DefaultAxesLineStyle','-'); case 4, set(Fig.plot, ... 'DefaultAxesColorOrder',[ 0 0 0 ], ... 'DefaultAxesLineStyle','-'); otherwise, set(Fig.plot, ... 'DefaultAxesColorOrder',Settings.color, ... 'DefaultAxesLineStyle','-'); end fm_plot('plotvars') case 'editvarname' value = get(Hdl_listplot,'Value'); if ~isempty(get(Hdl_listplot,'String')) valori = get(Hdl_listvar,'Value'); val = valori(Varname.po(value)); stringa = get(Fig.plot,'UserData'); nomeattuale = popupstr(Hdl_listplot); idx = findstr(nomeattuale,']'); nomeattuale = nomeattuale(idx+2:end); nomenuovo = fm_input('Input Formatted Text:', ... 'Legend Name',1,{stringa{val}}); if isempty(nomenuovo), return, end Varname.changes(val) = 1; stringa{val} = nomenuovo{1}; set(Fig.plot,'UserData',stringa); fm_disp(['Formatted text of variable "', ... nomeattuale,'" has been changed in "', ... nomenuovo{1},'"']) else fm_disp('No variable selected') end case 'motion' if Settings.zoom xy = get(Fig.plot,'CurrentPoint'); if xy(1) > 0.0616 & xy(1) < 0.5644 & xy(2) > 0.4190 & xy(2) < 0.9098 set(Fig.plot,'Pointer','crosshair'); eval(Settings.zoom) elseif xy(1) > 0.0638 & xy(1) < 0.2329 & xy(2) > 0.0663 & xy(2) < 0.2265 set(Fig.plot,'Pointer','arrow'); zoom off else set(Fig.plot,'Pointer','arrow'); eval(Settings.zoom) end set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion'); refreshfcn return end case 'zoomy' zoom yon set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion'); set(hdl_zoom1,'Value',0); set(hdl_zoom2,'Value',0); if get(hdl_zoom3,'Value') Settings.zoom = 'zoom yon'; else Settings.zoom = ''; zoom off end case 'axesy' if get(hdl_x,'Value') set(hdl_x,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) end if get(hdl_xy,'Value') set(hdl_xy,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) delete(findobj(allchild(hdlfig),'UserData','y axis')) end value = get(gcbo,'Value'); if value ylim = get(hdlfig,'YLim'); hold on h = plot([0 0],[ylim(1), ylim(2)],'k:'); set(h,'UserData','y axis') hold off else hdl_child = allchild(hdlfig); delete(findobj(hdl_child,'UserData','y axis')) end if Fig.line, fm_plot('createlinelist'), end case 'axescolor' currentColor = get(hdlfig,'Color'); c = uisetcolor(currentColor); if ~isequal(c,currentColor) set(hdlfig,'Color',c); hdl_line = findobj(allchild(hdlfig),'Type','line'); set(hdl_line,'MarkerFaceColor',c) hlegend = findobj(Fig.plot,'Tag','legend'); set(hlegend,'Color',c) end case 'axesx' if get(hdl_y,'Value') set(hdl_y,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) end if get(hdl_xy,'Value') set(hdl_xy,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) delete(findobj(allchild(hdlfig),'UserData','x axis')) end value = get(gcbo,'Value'); if value xlim = get(hdlfig,'XLim'); hold on h = plot([xlim(1), xlim(2)], [0, 0],'k:'); set(h,'UserData','x axis') hold off else hdl_child = allchild(hdlfig); delete(findobj(hdl_child,'UserData','x axis')) end if Fig.line, fm_plot('createlinelist'), end case 'axesxy' if get(hdl_x,'Value') set(hdl_x,'Value',0) delete(findobj(allchild(hdlfig),'UserData','x axis')) end if get(hdl_y,'Value') set(hdl_y,'Value',0) delete(findobj(allchild(hdlfig),'UserData','y axis')) end value = get(gcbo,'Value'); if value xlim = get(hdlfig,'XLim'); ylim = get(hdlfig,'YLim'); hold on h = plot([xlim(1), xlim(2)], [0, 0],'k:'); set(h,'UserData','x axis') h = plot([0, 0],[ylim(1), ylim(2)],'k:'); set(h,'UserData','y axis') hold off else hdl_child = allchild(hdlfig); try, delete(findobj(hdl_child,'UserData','x axis')), end try, delete(findobj(hdl_child,'UserData','y axis')), end end if Fig.line, fm_plot('createlinelist'), end case 'zoomx' zoom xon set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion'); set(hdl_zoom1,'Value',0); set(hdl_zoom3,'Value',0); if get(hdl_zoom2,'Value') Settings.zoom = 'zoom xon'; else Settings.zoom = ''; zoom off end case 'zoomxy' zoom on set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion'); set(hdl_zoom2,'Value',0); set(hdl_zoom3,'Value',0); if get(hdl_zoom1,'Value') Settings.zoom = 'zoom on'; else Settings.zoom = ''; zoom off end case 'moveup' value = get(Hdl_listplot,'Value'); NameString = get(Hdl_listplot,'String'); Value = 1:length(NameString); if value > 1 dummy = Varname.po(value); Varname.po(value) = Varname.po(value-1); Varname.po(value-1) = dummy; dummy = Value(value); Value(value) = Value(value-1); Value(value-1) = dummy; set(Hdl_listplot, ... 'String',NameString(Value), ... 'Value',value-1); end case 'movedown' value = get(Hdl_listplot,'Value'); NameString = get(Hdl_listplot,'String'); Value = 1:length(NameString); if value < length(Varname.po) & ~isempty(NameString) dummy = Varname.po(value); Varname.po(value) = Varname.po(value+1); Varname.po(value+1) = dummy; dummy = Value(value); Value(value) = Value(value+1); Value(value+1) = dummy; set(Hdl_listplot, ... 'String',NameString(Value), ... 'Value',value+1); end case 'togglegrid' if get(gcbo,'Value'), grid on, else, grid off, end case 'togglelegend' if Settings.hostver >= 7 legend(Hdl.axesplot,'toggle') else onoff = {'off','on'}; if strcmp(get(gcbo,'Tag'),'PushLegend') set(Hdl_legend,'Value',~get(Hdl_legend,'Value')) set(gcbo,'Checked',onoff{get(Hdl_legend,'Value')+1}) value = get(Hdl_legend,'Value'); else hdl = findobj(Fig.plot,'Tag','PushLegend'); set(hdl,'Checked',onoff{get(gcbo,'Value')+1}) value = get(gcbo,'Value'); end if value fm_plot('plotvars') else legend off end end case 'listvars' Value = get(Hdl_listvar,'Value'); if isempty(Value), return, end NameString = get(Hdl_listvar,'String'); if isempty(NameString), return, end set(Hdl_listplot,'String',NameString(Value)); set(Hdl_listplot,'Value',1); Varname.po = 1:length(Value); if strcmp(get(Fig.plot,'SelectionType'),'open'), fm_plot('plotvars') end case 'listlines' hdl = findobj(Fig.line,'Tag','Listbox1'); Value = get(hdl,'Value'); hdl_line = get(Fig.line,'UserData'); hdl_line = hdl_line(end:-1:1); n_var = length(get(Hdl_listplot,'String')); fm_linedlg(hdl_line(Value)) case 'createlinelist' hdl_line = findobj(allchild(hdlfig),'Type','line'); variabili = get(Hdl_listplot,'String'); set(Fig.line,'UserData',hdl_line); hdl_list = findobj(Fig.line,'Tag','Listbox1'); line_string = cell(length(hdl_line),1); hdl_line = hdl_line(end:-1:1); for i = 1:length(hdl_line) if strcmp(get(hdl_line(i),'UserData'),'x axis') line_string{i,1} = ['x axis ',fvar(i,4)]; elseif strcmp(get(hdl_line(i),'UserData'),'y axis') line_string{i,1} = ['y axis ',fvar(i,4)]; elseif i <= length(variabili) line_string{i,1} = ['line ',fvar(i,4),variabili{i}]; else line_string{i,1} = ['symbol ',fvar(i,4), ... variabili{i-length(variabili)}]; end end set(hdl_list,'String',line_string,'Value',1); case 'axesprops' fm_axesdlg(hdlfig) case 'textprops' TextProp = uisetfont; if isstruct(TextProp) set(hdlfig,TextProp) set(get(hdlfig,'XLabel'),TextProp) set(get(hdlfig,'YLabel'),TextProp) set(get(hdlfig,'Title'),TextProp) if get(Hdl_legend,'Value') hlegend = findobj(Fig.plot,'Tag','legend'); hchild = get(hlegend,'Child'); set(hchild(end), ... 'FontName',TextProp.FontName, ... 'FontWeight', TextProp.FontWeight, ... 'FontAngle',TextProp.FontAngle) end end case 'setxlabel' value = get(gcbo,'Value'); set(gcbo,'Value',value(end)) if strcmp(get(Fig.plot,'SelectionType'),'open') fm_plot('plotvars') end case 'setangles' idx = []; kdx = []; for i = 1:length(Varout.idx) kkk = Varout.idx(i); if kkk > DAE.n+2*Bus.n break elseif kkk <= DAE.n if ~isempty(find(Syn.delta == kkk)) idx = [idx, kkk]; kdx = [kdx, i]; end elseif kkk > DAE.n+Bus.n & kkk <= DAE.n+2*Bus.n idx = [idx, kkk]; kdx = [kdx, i]; end end set(gcbo, ... 'String',[{'None'}; Varname.uvars(idx)], ... 'UserData',kdx)endif ~isempty(Settings.zoom) eval(Settings.zoom) set(Fig.plot,'WindowButtonMotionFcn','fm_plot motion');endrefreshfcn% ------------------------------------------------------------------------% Enumeration of variables% ------------------------------------------------------------------------function stringa = enum(stringa)for i = 1:length(stringa), stringa{i} = ['[',int2str(i),'] ',stringa{i}];end% ------------------------------------------------------------------------% Refresh WindowButtonDownFcn and WindowButtonMotionFcn% ------------------------------------------------------------------------function refreshfcn% This fixes what seems to be a bug of the "zoom" function% that deletes WindowButtonDownFcn and WindowButtonMotionFcn% callbacks of other open windows...global Figif Fig.about, set(Fig.about,'WindowButtonDownFcn','fm_about aboutdown', ... 'WindowButtonMotionFcn','fm_about aboutmove')endif Fig.author set(Fig.author,'WindowButtonDownFcn','close(gcf)')endif Fig.clock set(Fig.clock,'WindowButtonDownFcn', ... 'set(Fig.clock,''Userdata'',-1)')endif Fig.comp set(Fig.comp,'WindowButtonDownFcn','fm_component cbdown', ... 'WindowButtonMotionFcn','fm_component cbmotion')endif Fig.main set(Fig.main,'WindowButtonDownFcn','fm_main buttondown', ... 'WindowButtonMotionFcn','fm_main buttonmotion')endif Fig.simset set(Fig.simset,'WindowButtonDownFcn','fm_simset buttondown', ... 'WindowButtonMotionFcn','fm_simset buttonmotion')endif Fig.update set(Fig.update,'WindowButtonDownFcn','fm_update author')end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -