How can I include a superscript in my x-label
14 次查看(过去 30 天)
显示 更早的评论
I'm having a problem with labeling my x-axis with powers of 10. For example, I have 8 sample collections with concentrations ranging from 10^-3 - 10^-9.
5 个评论
Adam Danz
2019-8-15
编辑:Adam Danz
2019-8-15
This: x=0:10^-3:10^-4:10^-5:10^-6:10^-7:10^-8:10^-9;
is not anything meaningful. It results in x=0.
Is this more like what you're looking for (I doubt it)?
x=[0, 10^-3, 10^-4, 10^-5, 10^-6, 10^-7, 10^-8, 10^-9];
y=[3198.8 2222.8 2798.8 2728.8 3671 4408.5 4303.5 4485.3];
bar(x,y)
ax = gca();
ax.XScale = 'log'
"I just need help with my x-axis labeling. "
You haven't explained what you need help with - what's wrong with the labels? How would you like to change them? By "labels" I think you mean X-Tick labels.
回答(1 个)
Star Strider
2019-8-15
编辑:Star Strider
2019-8-15
EDIT —
I am not sure what tick labels you want.
Try this:
y=[3198.8 2222.8 2798.8 2728.8 3671 4408.5 4303.5 4485.3];
figure
bar(y)
Ax = gca;
xlbl = sprintfc('10^{%2d}', -(3:9));
Ax.XTickLabel = [{'0'} xlbl];
Ax.FontSize = 9;
The tick labels can easily be changed when I understand what you want them to be.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!