How can I include a superscript in my x-label
Show older comments
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 Comments
Adam Danz
on 15 Aug 2019
How are you creating your plot? You can manipulate the notation in most of the plots but we need more detail. What kind of tick marks would you like?
Anthony Arteaga
on 15 Aug 2019
Adam Danz
on 15 Aug 2019
Is this your question (about the error message) or is this a different question that your original one above?
Anthony Arteaga
on 15 Aug 2019
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.
Answers (1)
Star Strider
on 15 Aug 2019
Edited: Star Strider
on 15 Aug 2019
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.
Categories
Find more on Labels and Annotations 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!