How to make xtick where there is a tick label in bold?

43 views (last 30 days)
How to make the xtick mark where I have a label in bold (as shown in attached figure).
Here is the code I use to generate the figure:
years = [1979:1:2021];
hold on;
axis on;
grid on;
box on;
yline(M,'-k','LineWidth',2); %yline(M,'-k','mean');
yline(M+S,'--k','LineWidth',2); %yline(M+S,'--k','mean + 1*std');
yline(M-S,'--k','LineWidth',2); %yline(M-S,'--k','mean - 1*std');
p1=plot(positiveAnomaly,TS_Mask(find(TS_Mask >= M+S)),'^');
p1.MarkerSize = 12;
p1.MarkerFaceColor = 'black';
p1.MarkerEdgeColor = 'black';
p2=plot(negativeAnomaly,TS_Mask(find(TS_Mask <= M-S)),'v');
p2.MarkerSize = 12;
p2.MarkerFaceColor = 'black';
p2.MarkerEdgeColor = 'black';
p2007 = plot(2007,TS_Mask(29),'o','MarkerFaceColor','black','MarkerEdgeColor','black','MarkerSize',12);
p2012 = plot(2012,TS_Mask(34),'o','MarkerFaceColor','black','MarkerEdgeColor','black','MarkerSize',12);
ylabel('SLP [hPa]','FontSize',24)
xlim([1978 2022]);
I want to add bold tick mark in x where I have the x tick labels i.e. 1980, 1985, 1990, etc.
How can I do this?
Thank you

Answers (1)

Walter Roberson
Walter Roberson on 28 Jun 2022
xticklabels({'','','\bf 1980','','','','','\bf 1985',...
'','','','','\bf 1990','','','','','\bf 1995','','','','','\bf 2000',...
'','','','','\bf 2005','','','','','\bf 2010','','','','','\bf 2015',...
'','','','','\bf 2020',''.''})
Walter Roberson
Walter Roberson on 28 Jun 2022
Edited: Walter Roberson on 28 Jun 2022
Do not xticks all the values. xticks the ones you want in bold, and set the minorticks to take care of everything else

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!