Prev: changing the format of the results displayed in command window?
Next: Reading a Header txt file
From: Faezeh Safari on 26 Jul 2010 19:22 Hi there, I have a code and want to generte many plots to check many different things. As the result, I have many of the following command line bunches as follows. I want to at least avoid of repeating "'FontName','Times New Roman','FontSize',10,'FontWeight','bold'" which as you can see has been repeated in "xlabel","ylabel","title", and "set(gca,...)". I defind a string variable like FontStyle =['FontName','Times New Roman','FontSize',10,'FontWeight','bold'] and also FontStyle ={'FontName','Times New Roman','FontSize',10,'FontWeight','bold'}; and used it as xlabel('...',Font). But, it didn't work!!! Can somebody help me with that? Here is part of the code: NF = NF + 1; figure(NF); hold on ; grid ; plot(thetaId,360-2*kd*d*cos(thetaId*pi/180)*180/pi,'m-','LineWidth',2) plot(thetaId0,AttPhaseS11TETE0,'c-+','LineWidth',2) plot(thetaId,AttPhaseS11TETE_NoShift,'r-o','LineWidth',2) plot(thetaId0,AttPhaseS11TMTM0,'g-*','LineWidth',2) plot(thetaId,AttPhaseS11TMTM_NoShift,'b-.','LineWidth',2) xlabel('Incident Angle, (\theta)^\circ','FontName','Times New Roman','FontSize',10,'FontWeight','bold') ylabel('Maximum Attainable S_{11} Phase','FontName','Times New Roman','FontSize',10,'FontWeight','bold') title(FigureTitle,'FontName','Times New Roman','FontSize',10,'FontWeight','bold') legend('Theoretical','Before Interp, TE-TE','After Interp, TE-TE','Before Interp, TM-TM','After Interp, TM-TM') set(gca,'FontName','Times New Roman','FontSize',10,'FontWeight','bold','LineWidth',2) set(gcf,'Position',Figure_Size) xlim([min(thetaId0) max(thetaId0)])
From: us on 26 Jul 2010 19:32 "Faezeh Safari" <safari(a)ee.umanitoba.ca> wrote in message <i2l5bc$a36$1(a)fred.mathworks.com>... > Hi there, > I have a code and want to generte many plots to check many different things. As the result, I have many of the following command line bunches as follows. I want to at least avoid of repeating "'FontName','Times New Roman','FontSize',10,'FontWeight','bold'" which as you can see has been repeated in "xlabel","ylabel","title", and "set(gca,...)". I defind a string variable like FontStyle =['FontName','Times New Roman','FontSize',10,'FontWeight','bold'] and also FontStyle ={'FontName','Times New Roman','FontSize',10,'FontWeight','bold'}; and used it as xlabel('...',Font). But, it didn't work!!! Can somebody help me with that? a hint: xlabel(...,Font{:}); us
From: Pekka Kumpulainen on 27 Jul 2010 04:05 "Faezeh Safari" <safari(a)ee.umanitoba.ca> wrote in message <i2l5bc$a36$1(a)fred.mathworks.com>... > Hi there, > I have a code and want to generte many plots to check many different things. As the result, I have many of the following command line bunches as follows. I want to at least avoid of repeating "'FontName','Times New Roman','FontSize',10,'FontWeight','bold'" which as you can see has been repeated in "xlabel","ylabel","title", and "set(gca,...)". I defind a string variable like FontStyle =['FontName','Times New Roman','FontSize',10,'FontWeight','bold'] and also FontStyle ={'FontName','Times New Roman','FontSize',10,'FontWeight','bold'}; and used it as xlabel('...',Font). But, it didn't work!!! Can somebody help me with that? > One way to avoid repeating those is to set the default properties of either the figure or axis you plot on or the root object. Learn more in help, go to MATLAB -> User Guide -> Graphics -> Handle Graphics Objects -> Setting Default Property Values For example: set(0,'DefaultTextFontsize',10, ... 'DefaultTextFontname','Times New Roman', ... 'DefaultTextFontWeight','bold', ... 'DefaultAxesFontsize',10, ... 'DefaultAxesFontname','Times New Roman', ... 'DefaultLineLineWidth', 2) etc. Or you can use the cell arrays as instructed above to create different default sets for different figures for example: set1 = {'DefaultAxesFontsize',10,'DefaultLineLineWidth', 2}; set2 = {'DefaultAxesFontsize',16,'DefaultLineLineWidth', 5}; hf1 = figure(set1{:}); plot(randn(10,2)) hf2 = figure(set2{:}); plot(randn(10,2)) hth
From: Steven_Lord on 27 Jul 2010 10:32 "Pekka Kumpulainen" <pekka.nospam.kumpulainen(a)tut.please.fi> wrote in message news:i2m3vk$s8v$1(a)fred.mathworks.com... > "Faezeh Safari" <safari(a)ee.umanitoba.ca> wrote in message > <i2l5bc$a36$1(a)fred.mathworks.com>... >> Hi there, >> I have a code and want to generte many plots to check many different >> things. As the result, I have many of the following command line bunches >> as follows. I want to at least avoid of repeating "'FontName','Times New >> Roman','FontSize',10,'FontWeight','bold'" which as you can see has been >> repeated in "xlabel","ylabel","title", and "set(gca,...)". I defind a >> string variable like FontStyle =['FontName','Times New >> Roman','FontSize',10,'FontWeight','bold'] and also FontStyle >> ={'FontName','Times New Roman','FontSize',10,'FontWeight','bold'}; and >> used it as xlabel('...',Font). But, it didn't work!!! Can somebody help >> me with that? >> > > One way to avoid repeating those is to set the default properties of > either the figure or axis you plot on or the root object. Learn more in > help, go to > MATLAB -> User Guide -> Graphics -> Handle Graphics Objects -> Setting > Default Property Values > > For example: > set(0,'DefaultTextFontsize',10, ... > 'DefaultTextFontname','Times New Roman', ... > 'DefaultTextFontWeight','bold', ... > 'DefaultAxesFontsize',10, ... > 'DefaultAxesFontname','Times New Roman', ... > 'DefaultLineLineWidth', 2) That will change the default properties for any new Text, Axes, or Line object created from this point forward that has the root object as an ancestor when created (i.e. all of them.) The OP probably wants to use the cell array approach you'd included below, or to create a function that sets the defaults: function h = applyDefaultFontProperties(h) % Yes, I know this also changes the Line's LineWidth property % but the name is already longish as is. set(h,'DefaultTextFontsize',10, ... 'DefaultTextFontname','Times New Roman', ... 'DefaultTextFontWeight','bold', ... 'DefaultAxesFontsize',10, ... 'DefaultAxesFontname','Times New Roman', ... 'DefaultLineLineWidth', 2) and apply this function to the figure. h = applyDefaultFontPropeties(figure()); -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Faezeh Safari on 27 Jul 2010 15:28 Thanks for your reply! I did exactly what I was told in this message but I got this error message: "??? Undefined function or method 'applyDefaultFontPropeties' for input arguments of type 'double'." "Steven_Lord" <slord(a)mathworks.com> wrote in message <i2mql7$48l$1(a)fred.mathworks.com>... > > > "Pekka Kumpulainen" <pekka.nospam.kumpulainen(a)tut.please.fi> wrote in > message news:i2m3vk$s8v$1(a)fred.mathworks.com... > > "Faezeh Safari" <safari(a)ee.umanitoba.ca> wrote in message > > <i2l5bc$a36$1(a)fred.mathworks.com>... > >> Hi there, > >> I have a code and want to generte many plots to check many different > >> things. As the result, I have many of the following command line bunches > >> as follows. I want to at least avoid of repeating "'FontName','Times New > >> Roman','FontSize',10,'FontWeight','bold'" which as you can see has been > >> repeated in "xlabel","ylabel","title", and "set(gca,...)". I defind a > >> string variable like FontStyle =['FontName','Times New > >> Roman','FontSize',10,'FontWeight','bold'] and also FontStyle > >> ={'FontName','Times New Roman','FontSize',10,'FontWeight','bold'}; and > >> used it as xlabel('...',Font). But, it didn't work!!! Can somebody help > >> me with that? > >> > > > > One way to avoid repeating those is to set the default properties of > > either the figure or axis you plot on or the root object. Learn more in > > help, go to > > MATLAB -> User Guide -> Graphics -> Handle Graphics Objects -> Setting > > Default Property Values > > > > For example: > > set(0,'DefaultTextFontsize',10, ... > > 'DefaultTextFontname','Times New Roman', ... > > 'DefaultTextFontWeight','bold', ... > > 'DefaultAxesFontsize',10, ... > > 'DefaultAxesFontname','Times New Roman', ... > > 'DefaultLineLineWidth', 2) > > That will change the default properties for any new Text, Axes, or Line > object created from this point forward that has the root object as an > ancestor when created (i.e. all of them.) > > The OP probably wants to use the cell array approach you'd included below, > or to create a function that sets the defaults: > > function h = applyDefaultFontProperties(h) > % Yes, I know this also changes the Line's LineWidth property > % but the name is already longish as is. > set(h,'DefaultTextFontsize',10, ... > 'DefaultTextFontname','Times New Roman', ... > 'DefaultTextFontWeight','bold', ... > 'DefaultAxesFontsize',10, ... > 'DefaultAxesFontname','Times New Roman', ... > 'DefaultLineLineWidth', 2) > > and apply this function to the figure. > > h = applyDefaultFontPropeties(figure()); > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
|
Next
|
Last
Pages: 1 2 Prev: changing the format of the results displayed in command window? Next: Reading a Header txt file |