How to bold x axis labels
    6 views (last 30 days)
  
       Show older comments
    
    BENJAMIN BUCHDA
 on 18 Mar 2021
  
    
    
    
    
    Answered: Steve Eddins
      
 on 18 Mar 2021
            Hi, I am trying to bold my x axis of my scatter plot. I would like to bold the x axis values that are equal to 0 and values that are divisible by 10. Any help or advice would be much appreciated. I will attach the sample x and y data that is used for this scatter plot.
    myFig = gcf;
    myAx = axes(myFig);
    plot01 = scatter(myAx, xData, yData);
    myAx.Box = 'on';
    myAx.XLabel.String = 'X'; 
    myAx.YLabel.String = 'Y';
    myAx.Title.String = 'Scatter Plot';
    plot01.CData = [0 0.4470 0.7410];
    plot01.Marker = 'x';
    X = myAx.XAxis.TickLabels;
    Y = str2double(X);
    Y = Y';
    division = rem(Y,10) == 0;
    for i = 1:length(Y) 
        if i == division
            myAx.XAxis.TickLabels{i} = ['\bf', Y];
        end
    end
0 Comments
Accepted Answer
  Steve Eddins
      
 on 18 Mar 2021
        Try setting the TickLabelsInterpreter property to 'tex', like this:
plot(1:10)
ax = gca;
ax.XAxis.TickLabelInterpreter = 'tex';
ax.XAxis.TickLabels{3} = '\bf 4';
0 Comments
More Answers (0)
See Also
Categories
				Find more on Scatter Plots in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

