bolding x axis label in a subplot figure

5 Ansichten (letzte 30 Tage)
Jessica
Jessica am 25 Jan. 2015
Kommentiert: Star Strider am 25 Jan. 2015
I am trying to make the x-axis label bold in a subplot, such as the one below. The Y axis labels are bold but the bold command doesn't seem to work for the x axis.
figure % create new figure
Axis1=1;
Axis2=5;
ChartTime2=[1 2 3 4 5];
X_Chart=[.2 .1 .4 .5 .6];
Y_Chart=[.3 .4 .5 .7 .1];
Z_Chart=[.1 .5 .4 .4 .4];
ha(1)=subplot(3,1,1); % first subplot
plot(ChartTime2,X_Chart,'k')
axis([Axis1 Axis2 -1 1])
ylabel('X', 'fontsize',14,'FontWeight','bold');
ha(2)=subplot(3,1,2); % second subplot
plot(ChartTime2,Y_Chart,'k')
axis([Axis1 Axis2 -1 1])
ylabel('Y', 'fontsize',14,'FontWeight','bold');
ha(3)=subplot(3,1,3); % third subplot
plot(ChartTime2,Z_Chart,'k')
axis([Axis1 Axis2 -1 1]); %Set axis and then use hand tool to move through graph
ylabel('Z', 'fontsize',14,'FontWeight','bold');
xlabel('Time (sec)', 'fontsize',14,'FontWeight','bold');
  1 Kommentar
Star Strider
Star Strider am 25 Jan. 2015
You don’t mention the version of MATLAB you’re using, since there may be version differences.
In 2014b (with the default options) they all appear bold, as you specified them to be. I can’t reproduce the problem you’re seeing, so I’m not submitting this an an Answer.
Another option might be to use the TeX control character:
ylabel('\bfY\rm', 'fontsize',14);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Chad Greene
Chad Greene am 25 Jan. 2015
Try changing the figure renderer ( set(gcf,'renderer','opengl') or set(gcf,'renderer','painters') ). Sometimes the fontweights are actually set the way you want them even though it does not look like it in the figure window. Sometimes you have to use export_fig to save the image, and then you'll see that the font is actually bold.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by