Multi-colored tick labels in bold, redux
Mostra commenti meno recenti
From this thread I learned from @Tommy how to create individually colored tick labels, using the Label function defined in the code below. In this thread, @JanSimon says how to create bold face tick labels. But this suggestion doesn't seem to work. If you run this code to the keyboard, you'll see the colored tick labels, but they are in a very wishywashy pallette. I'm hoping that switching to bold face might help, but when I `dbcont` to the next line, the labels disappear. I thought the problem maybe related to needing two backslashes in front of the lambda 's but that doesn't help either. Could somebody please explain what I'm doing wrong? Thanks very much
n = 4;
C = [ ...
0.5142 0.7695 0.7258 ;
0.9300 0.8644 0.4048 ;
0.6929 0.6784 0.7951 ;
0.9154 0.4668 0.4158 ;
0.9227 0.6565 0.3574 ;
0.6528 0.8096 0.3829 ;
0.6856 0.4668 0.6893 ;
0.7914 0.7914 0.7914 ;
0.9191 0.7476 0.8352 ];
Label = @(ii,s) sprintf('\\color[rgb]{%f, %f, %f}%s', C(ii,:), s);
Y = sort(rand(n,n));
h = plot(1:n,Y);
for ii=1:n;
h(ii).Color=C(ii,:);
end
set(gca,'XTick',1:n);
legend
for ii=1:n
XTickLabel{ii} = Label(ii,['\lambda_' num2str(ii)]);
end
set(gca,'XTickLabel',XTickLabel);
axesH = gca;
axesH.XAxis.TickLabelFormat = '\\textbf{%g}';
keyboard;
axesH.XAxis.TickLabelInterpreter = 'latex'
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Labels and Annotations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!