Controlling subplot font properties at once but independently












1















I'm trying to control the properties for subplot's title in a way that is independent of other font properties while using latex as interpreter (I don't think this last part is relevant, but just in case). Here is a sample code:



% Figure handle
fig1 = figure;

% Subplot 1
subplot(2,1,1)
plot(rand(100,1))
xlabel('$x$ label')
ylabel('$y$ label')
title('First subplot')

% Subplot 2
subplot(2,1,2)
plot(rand(100,1))
xlabel('$x$ label')
ylabel('$y$ label')
title('Second subplot')

% Setting global properties
set(findall(fig1,'-property','FontSize'),'FontSize',14)
set(findall(fig1,'-property','Interpreter'),'Interpreter','Latex')
set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','Latex')


When I do this, I can set the size and interpreter for axis labels, tick labels, and subplot titles. This makes the title to have the same style as those other objects.



Is there a way to control the titles properties independently to make them slightly bigger and bolder, for example, so they are easily distinguishable from axis labels?










share|improve this question



























    1















    I'm trying to control the properties for subplot's title in a way that is independent of other font properties while using latex as interpreter (I don't think this last part is relevant, but just in case). Here is a sample code:



    % Figure handle
    fig1 = figure;

    % Subplot 1
    subplot(2,1,1)
    plot(rand(100,1))
    xlabel('$x$ label')
    ylabel('$y$ label')
    title('First subplot')

    % Subplot 2
    subplot(2,1,2)
    plot(rand(100,1))
    xlabel('$x$ label')
    ylabel('$y$ label')
    title('Second subplot')

    % Setting global properties
    set(findall(fig1,'-property','FontSize'),'FontSize',14)
    set(findall(fig1,'-property','Interpreter'),'Interpreter','Latex')
    set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','Latex')


    When I do this, I can set the size and interpreter for axis labels, tick labels, and subplot titles. This makes the title to have the same style as those other objects.



    Is there a way to control the titles properties independently to make them slightly bigger and bolder, for example, so they are easily distinguishable from axis labels?










    share|improve this question

























      1












      1








      1








      I'm trying to control the properties for subplot's title in a way that is independent of other font properties while using latex as interpreter (I don't think this last part is relevant, but just in case). Here is a sample code:



      % Figure handle
      fig1 = figure;

      % Subplot 1
      subplot(2,1,1)
      plot(rand(100,1))
      xlabel('$x$ label')
      ylabel('$y$ label')
      title('First subplot')

      % Subplot 2
      subplot(2,1,2)
      plot(rand(100,1))
      xlabel('$x$ label')
      ylabel('$y$ label')
      title('Second subplot')

      % Setting global properties
      set(findall(fig1,'-property','FontSize'),'FontSize',14)
      set(findall(fig1,'-property','Interpreter'),'Interpreter','Latex')
      set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','Latex')


      When I do this, I can set the size and interpreter for axis labels, tick labels, and subplot titles. This makes the title to have the same style as those other objects.



      Is there a way to control the titles properties independently to make them slightly bigger and bolder, for example, so they are easily distinguishable from axis labels?










      share|improve this question














      I'm trying to control the properties for subplot's title in a way that is independent of other font properties while using latex as interpreter (I don't think this last part is relevant, but just in case). Here is a sample code:



      % Figure handle
      fig1 = figure;

      % Subplot 1
      subplot(2,1,1)
      plot(rand(100,1))
      xlabel('$x$ label')
      ylabel('$y$ label')
      title('First subplot')

      % Subplot 2
      subplot(2,1,2)
      plot(rand(100,1))
      xlabel('$x$ label')
      ylabel('$y$ label')
      title('Second subplot')

      % Setting global properties
      set(findall(fig1,'-property','FontSize'),'FontSize',14)
      set(findall(fig1,'-property','Interpreter'),'Interpreter','Latex')
      set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','Latex')


      When I do this, I can set the size and interpreter for axis labels, tick labels, and subplot titles. This makes the title to have the same style as those other objects.



      Is there a way to control the titles properties independently to make them slightly bigger and bolder, for example, so they are easily distinguishable from axis labels?







      matlab matlab-figure






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 12:24









      LooperLooper

      918




      918
























          3 Answers
          3






          active

          oldest

          votes


















          1














          The set instruction can be applied to an array of graphic handle, so if you want to modify properties of all your titles, just gather their handles in an array first, then use the set command on the handle array.



          So in your example, replace your



          % ...
          title('First subplot')
          % ...
          title('Second subplot')
          % ...


          by:



          % ...
          ht(1) = title('First subplot')
          % ...
          ht(2) = title('Second subplot')
          % ...


          You now have an array of handles ht to your titles. Now to modify them all in one batch, without modifying anything else:



          set( ht , 'FontSize',18, 'FontWeight','bold')




          Similarly, you could regroup handles of other objects to assign their properties in one go:



          % build a collection of xlabel array
          hxlabel = [hax(1).XLabel hax(2).XLabel] ;
          % Set their label and interpreter all at once
          set( hxlabel , 'String' , '$x$ label' , 'Interpreter','Latex' )


          This will apply the same xlabel to all the subplot, and set their interpreter to latex at the same time.



          The same reasonning can be applied for the ylabel, or any other common property accross many objects.






          share|improve this answer

































            2














            If you just want to make the titles bigger, you can set it when calling the title command:



            title('First subplot', 'FontSize', 14, 'FontWeight', 'bold')


            If you want to have more control over the font sizes of the individual objects, you have to store the axis handle (which are created upon creating a subplot):



            ax1 = subplot(211)
            ax2 = subplot(212)

            % set the properties of the title:
            ax1.Title.FontSize = 14;

            % set the properties of the XAxis:
            ax1.XAxis.FontSize = 7;


            To see what settings you can change, just call the handle in the command window, which will give you more details:



            >> ax1.Title

            ans =

            Text (First subplot) with properties:

            String: 'First subplot'
            FontSize: 14
            FontWeight: 'bold'
            FontName: 'Helvetica'
            Color: [0 0 0]
            HorizontalAlignment: 'center'
            Position: [50.0001 1.0139 0]
            Units: 'data'




            If you want to set the properties of the titles in different axes (subplots) in a figure, you could store the axes in a cell array:



            ax = {subplot(211), subplot(212)};

            plot(ax{1}, rand(100,1));
            plot(ax{2}, rand(100,1));

            for i=1:numel(ax)
            ax{i}.Title.Fontsize = 14;
            end





            share|improve this answer


























            • I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

              – Looper
              Nov 22 '18 at 3:29











            • I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

              – Looper
              Nov 22 '18 at 13:57











            • @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

              – rinkert
              Nov 22 '18 at 14:03













            • You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

              – Looper
              Nov 22 '18 at 14:17



















            0














            For what it's worth, I got to solve this by setting the following "global" properties (placed at the end of the example above):



            % Setting global properties
            set(findall(fig1,'-property','Interpreter'),'Interpreter','latex')
            set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
            set(findall(fig1,'-property','Title'),'FontSize',14)
            set(findall(fig1.Children,'-property','TitleFontSizeMultiplier'),'TitleFontSizeMultiplier',1.8)


            Few things to note. The property Children.TitleFontSizeMultiplier in the figure handle scales whatever you have as FontSize. However, the specification FontSize cannot be placed before Interpreter, as this seems to lock any further font size specifications.



            If you want bold face when using the latex interpreter, you need to specify that directly in the title: title('textbf{First subplot}'). Changing the property Children.TitleFontWeight between normal and bold doesn't seem to have any effect.






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411975%2fcontrolling-subplot-font-properties-at-once-but-independently%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              The set instruction can be applied to an array of graphic handle, so if you want to modify properties of all your titles, just gather their handles in an array first, then use the set command on the handle array.



              So in your example, replace your



              % ...
              title('First subplot')
              % ...
              title('Second subplot')
              % ...


              by:



              % ...
              ht(1) = title('First subplot')
              % ...
              ht(2) = title('Second subplot')
              % ...


              You now have an array of handles ht to your titles. Now to modify them all in one batch, without modifying anything else:



              set( ht , 'FontSize',18, 'FontWeight','bold')




              Similarly, you could regroup handles of other objects to assign their properties in one go:



              % build a collection of xlabel array
              hxlabel = [hax(1).XLabel hax(2).XLabel] ;
              % Set their label and interpreter all at once
              set( hxlabel , 'String' , '$x$ label' , 'Interpreter','Latex' )


              This will apply the same xlabel to all the subplot, and set their interpreter to latex at the same time.



              The same reasonning can be applied for the ylabel, or any other common property accross many objects.






              share|improve this answer






























                1














                The set instruction can be applied to an array of graphic handle, so if you want to modify properties of all your titles, just gather their handles in an array first, then use the set command on the handle array.



                So in your example, replace your



                % ...
                title('First subplot')
                % ...
                title('Second subplot')
                % ...


                by:



                % ...
                ht(1) = title('First subplot')
                % ...
                ht(2) = title('Second subplot')
                % ...


                You now have an array of handles ht to your titles. Now to modify them all in one batch, without modifying anything else:



                set( ht , 'FontSize',18, 'FontWeight','bold')




                Similarly, you could regroup handles of other objects to assign their properties in one go:



                % build a collection of xlabel array
                hxlabel = [hax(1).XLabel hax(2).XLabel] ;
                % Set their label and interpreter all at once
                set( hxlabel , 'String' , '$x$ label' , 'Interpreter','Latex' )


                This will apply the same xlabel to all the subplot, and set their interpreter to latex at the same time.



                The same reasonning can be applied for the ylabel, or any other common property accross many objects.






                share|improve this answer




























                  1












                  1








                  1







                  The set instruction can be applied to an array of graphic handle, so if you want to modify properties of all your titles, just gather their handles in an array first, then use the set command on the handle array.



                  So in your example, replace your



                  % ...
                  title('First subplot')
                  % ...
                  title('Second subplot')
                  % ...


                  by:



                  % ...
                  ht(1) = title('First subplot')
                  % ...
                  ht(2) = title('Second subplot')
                  % ...


                  You now have an array of handles ht to your titles. Now to modify them all in one batch, without modifying anything else:



                  set( ht , 'FontSize',18, 'FontWeight','bold')




                  Similarly, you could regroup handles of other objects to assign their properties in one go:



                  % build a collection of xlabel array
                  hxlabel = [hax(1).XLabel hax(2).XLabel] ;
                  % Set their label and interpreter all at once
                  set( hxlabel , 'String' , '$x$ label' , 'Interpreter','Latex' )


                  This will apply the same xlabel to all the subplot, and set their interpreter to latex at the same time.



                  The same reasonning can be applied for the ylabel, or any other common property accross many objects.






                  share|improve this answer















                  The set instruction can be applied to an array of graphic handle, so if you want to modify properties of all your titles, just gather their handles in an array first, then use the set command on the handle array.



                  So in your example, replace your



                  % ...
                  title('First subplot')
                  % ...
                  title('Second subplot')
                  % ...


                  by:



                  % ...
                  ht(1) = title('First subplot')
                  % ...
                  ht(2) = title('Second subplot')
                  % ...


                  You now have an array of handles ht to your titles. Now to modify them all in one batch, without modifying anything else:



                  set( ht , 'FontSize',18, 'FontWeight','bold')




                  Similarly, you could regroup handles of other objects to assign their properties in one go:



                  % build a collection of xlabel array
                  hxlabel = [hax(1).XLabel hax(2).XLabel] ;
                  % Set their label and interpreter all at once
                  set( hxlabel , 'String' , '$x$ label' , 'Interpreter','Latex' )


                  This will apply the same xlabel to all the subplot, and set their interpreter to latex at the same time.



                  The same reasonning can be applied for the ylabel, or any other common property accross many objects.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 22 '18 at 18:44

























                  answered Nov 22 '18 at 18:32









                  HokiHoki

                  9,04411335




                  9,04411335

























                      2














                      If you just want to make the titles bigger, you can set it when calling the title command:



                      title('First subplot', 'FontSize', 14, 'FontWeight', 'bold')


                      If you want to have more control over the font sizes of the individual objects, you have to store the axis handle (which are created upon creating a subplot):



                      ax1 = subplot(211)
                      ax2 = subplot(212)

                      % set the properties of the title:
                      ax1.Title.FontSize = 14;

                      % set the properties of the XAxis:
                      ax1.XAxis.FontSize = 7;


                      To see what settings you can change, just call the handle in the command window, which will give you more details:



                      >> ax1.Title

                      ans =

                      Text (First subplot) with properties:

                      String: 'First subplot'
                      FontSize: 14
                      FontWeight: 'bold'
                      FontName: 'Helvetica'
                      Color: [0 0 0]
                      HorizontalAlignment: 'center'
                      Position: [50.0001 1.0139 0]
                      Units: 'data'




                      If you want to set the properties of the titles in different axes (subplots) in a figure, you could store the axes in a cell array:



                      ax = {subplot(211), subplot(212)};

                      plot(ax{1}, rand(100,1));
                      plot(ax{2}, rand(100,1));

                      for i=1:numel(ax)
                      ax{i}.Title.Fontsize = 14;
                      end





                      share|improve this answer


























                      • I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                        – Looper
                        Nov 22 '18 at 3:29











                      • I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                        – Looper
                        Nov 22 '18 at 13:57











                      • @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                        – rinkert
                        Nov 22 '18 at 14:03













                      • You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                        – Looper
                        Nov 22 '18 at 14:17
















                      2














                      If you just want to make the titles bigger, you can set it when calling the title command:



                      title('First subplot', 'FontSize', 14, 'FontWeight', 'bold')


                      If you want to have more control over the font sizes of the individual objects, you have to store the axis handle (which are created upon creating a subplot):



                      ax1 = subplot(211)
                      ax2 = subplot(212)

                      % set the properties of the title:
                      ax1.Title.FontSize = 14;

                      % set the properties of the XAxis:
                      ax1.XAxis.FontSize = 7;


                      To see what settings you can change, just call the handle in the command window, which will give you more details:



                      >> ax1.Title

                      ans =

                      Text (First subplot) with properties:

                      String: 'First subplot'
                      FontSize: 14
                      FontWeight: 'bold'
                      FontName: 'Helvetica'
                      Color: [0 0 0]
                      HorizontalAlignment: 'center'
                      Position: [50.0001 1.0139 0]
                      Units: 'data'




                      If you want to set the properties of the titles in different axes (subplots) in a figure, you could store the axes in a cell array:



                      ax = {subplot(211), subplot(212)};

                      plot(ax{1}, rand(100,1));
                      plot(ax{2}, rand(100,1));

                      for i=1:numel(ax)
                      ax{i}.Title.Fontsize = 14;
                      end





                      share|improve this answer


























                      • I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                        – Looper
                        Nov 22 '18 at 3:29











                      • I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                        – Looper
                        Nov 22 '18 at 13:57











                      • @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                        – rinkert
                        Nov 22 '18 at 14:03













                      • You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                        – Looper
                        Nov 22 '18 at 14:17














                      2












                      2








                      2







                      If you just want to make the titles bigger, you can set it when calling the title command:



                      title('First subplot', 'FontSize', 14, 'FontWeight', 'bold')


                      If you want to have more control over the font sizes of the individual objects, you have to store the axis handle (which are created upon creating a subplot):



                      ax1 = subplot(211)
                      ax2 = subplot(212)

                      % set the properties of the title:
                      ax1.Title.FontSize = 14;

                      % set the properties of the XAxis:
                      ax1.XAxis.FontSize = 7;


                      To see what settings you can change, just call the handle in the command window, which will give you more details:



                      >> ax1.Title

                      ans =

                      Text (First subplot) with properties:

                      String: 'First subplot'
                      FontSize: 14
                      FontWeight: 'bold'
                      FontName: 'Helvetica'
                      Color: [0 0 0]
                      HorizontalAlignment: 'center'
                      Position: [50.0001 1.0139 0]
                      Units: 'data'




                      If you want to set the properties of the titles in different axes (subplots) in a figure, you could store the axes in a cell array:



                      ax = {subplot(211), subplot(212)};

                      plot(ax{1}, rand(100,1));
                      plot(ax{2}, rand(100,1));

                      for i=1:numel(ax)
                      ax{i}.Title.Fontsize = 14;
                      end





                      share|improve this answer















                      If you just want to make the titles bigger, you can set it when calling the title command:



                      title('First subplot', 'FontSize', 14, 'FontWeight', 'bold')


                      If you want to have more control over the font sizes of the individual objects, you have to store the axis handle (which are created upon creating a subplot):



                      ax1 = subplot(211)
                      ax2 = subplot(212)

                      % set the properties of the title:
                      ax1.Title.FontSize = 14;

                      % set the properties of the XAxis:
                      ax1.XAxis.FontSize = 7;


                      To see what settings you can change, just call the handle in the command window, which will give you more details:



                      >> ax1.Title

                      ans =

                      Text (First subplot) with properties:

                      String: 'First subplot'
                      FontSize: 14
                      FontWeight: 'bold'
                      FontName: 'Helvetica'
                      Color: [0 0 0]
                      HorizontalAlignment: 'center'
                      Position: [50.0001 1.0139 0]
                      Units: 'data'




                      If you want to set the properties of the titles in different axes (subplots) in a figure, you could store the axes in a cell array:



                      ax = {subplot(211), subplot(212)};

                      plot(ax{1}, rand(100,1));
                      plot(ax{2}, rand(100,1));

                      for i=1:numel(ax)
                      ax{i}.Title.Fontsize = 14;
                      end






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 22 '18 at 12:28

























                      answered Nov 21 '18 at 13:32









                      rinkertrinkert

                      1,454517




                      1,454517













                      • I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                        – Looper
                        Nov 22 '18 at 3:29











                      • I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                        – Looper
                        Nov 22 '18 at 13:57











                      • @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                        – rinkert
                        Nov 22 '18 at 14:03













                      • You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                        – Looper
                        Nov 22 '18 at 14:17



















                      • I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                        – Looper
                        Nov 22 '18 at 3:29











                      • I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                        – Looper
                        Nov 22 '18 at 13:57











                      • @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                        – rinkert
                        Nov 22 '18 at 14:03













                      • You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                        – Looper
                        Nov 22 '18 at 14:17

















                      I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                      – Looper
                      Nov 22 '18 at 3:29





                      I am aware of the use of the title command. But that requires to set the properties for each title (or axis handle) individually. I was trying to find a way of changing the properties of all titles at once, like I do with the other properties in my example. Any ideas?

                      – Looper
                      Nov 22 '18 at 3:29













                      I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                      – Looper
                      Nov 22 '18 at 13:57





                      I had no luck with your new solution. I get the error No public property Fontsize exists for class matlab.graphics.primitive.Text.. Maybe this Title.Fontsize property is not present in all Matlab versions? I am using 2015b

                      – Looper
                      Nov 22 '18 at 13:57













                      @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                      – rinkert
                      Nov 22 '18 at 14:03







                      @Looper Oh forgot the capital I think, does it work with ax{i}.Title.FontSize?

                      – rinkert
                      Nov 22 '18 at 14:03















                      You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                      – Looper
                      Nov 22 '18 at 14:17





                      You are right, the capital S was needed. But this solution still has a lot of problems: (1) it doesn't seem to play well with multiple plots in the same axis, even after specifying hold on and plot(ax{i}, ....), it only plots the last plot in each axis, except in the last one in which you get all plots (weird, I know). (2) to get the titles, legends and axis labels working, you need to specify the axis in for each one of them, i.e. title(ax{1},'First'), etc, so not much value in automatizing the properties at the end.

                      – Looper
                      Nov 22 '18 at 14:17











                      0














                      For what it's worth, I got to solve this by setting the following "global" properties (placed at the end of the example above):



                      % Setting global properties
                      set(findall(fig1,'-property','Interpreter'),'Interpreter','latex')
                      set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
                      set(findall(fig1,'-property','Title'),'FontSize',14)
                      set(findall(fig1.Children,'-property','TitleFontSizeMultiplier'),'TitleFontSizeMultiplier',1.8)


                      Few things to note. The property Children.TitleFontSizeMultiplier in the figure handle scales whatever you have as FontSize. However, the specification FontSize cannot be placed before Interpreter, as this seems to lock any further font size specifications.



                      If you want bold face when using the latex interpreter, you need to specify that directly in the title: title('textbf{First subplot}'). Changing the property Children.TitleFontWeight between normal and bold doesn't seem to have any effect.






                      share|improve this answer




























                        0














                        For what it's worth, I got to solve this by setting the following "global" properties (placed at the end of the example above):



                        % Setting global properties
                        set(findall(fig1,'-property','Interpreter'),'Interpreter','latex')
                        set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
                        set(findall(fig1,'-property','Title'),'FontSize',14)
                        set(findall(fig1.Children,'-property','TitleFontSizeMultiplier'),'TitleFontSizeMultiplier',1.8)


                        Few things to note. The property Children.TitleFontSizeMultiplier in the figure handle scales whatever you have as FontSize. However, the specification FontSize cannot be placed before Interpreter, as this seems to lock any further font size specifications.



                        If you want bold face when using the latex interpreter, you need to specify that directly in the title: title('textbf{First subplot}'). Changing the property Children.TitleFontWeight between normal and bold doesn't seem to have any effect.






                        share|improve this answer


























                          0












                          0








                          0







                          For what it's worth, I got to solve this by setting the following "global" properties (placed at the end of the example above):



                          % Setting global properties
                          set(findall(fig1,'-property','Interpreter'),'Interpreter','latex')
                          set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
                          set(findall(fig1,'-property','Title'),'FontSize',14)
                          set(findall(fig1.Children,'-property','TitleFontSizeMultiplier'),'TitleFontSizeMultiplier',1.8)


                          Few things to note. The property Children.TitleFontSizeMultiplier in the figure handle scales whatever you have as FontSize. However, the specification FontSize cannot be placed before Interpreter, as this seems to lock any further font size specifications.



                          If you want bold face when using the latex interpreter, you need to specify that directly in the title: title('textbf{First subplot}'). Changing the property Children.TitleFontWeight between normal and bold doesn't seem to have any effect.






                          share|improve this answer













                          For what it's worth, I got to solve this by setting the following "global" properties (placed at the end of the example above):



                          % Setting global properties
                          set(findall(fig1,'-property','Interpreter'),'Interpreter','latex')
                          set(findall(fig1,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
                          set(findall(fig1,'-property','Title'),'FontSize',14)
                          set(findall(fig1.Children,'-property','TitleFontSizeMultiplier'),'TitleFontSizeMultiplier',1.8)


                          Few things to note. The property Children.TitleFontSizeMultiplier in the figure handle scales whatever you have as FontSize. However, the specification FontSize cannot be placed before Interpreter, as this seems to lock any further font size specifications.



                          If you want bold face when using the latex interpreter, you need to specify that directly in the title: title('textbf{First subplot}'). Changing the property Children.TitleFontWeight between normal and bold doesn't seem to have any effect.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 22 '18 at 14:55









                          LooperLooper

                          918




                          918






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411975%2fcontrolling-subplot-font-properties-at-once-but-independently%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                              Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                              A Topological Invariant for $pi_3(U(n))$