Adding an Xlabel to a Semilogx plot?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I plotted a semilogx plot because I want my x values to be in log scale. However, now, when I try to add an xlabel, I can't do it! I looked on the forums and found the following answer:
set(get(gca,'xlabel'),'units','pixels'); set(get(gca,'xlabel'),'Pos', [10 10]);
However, I tried this and this also does not work.
Any reason why and how do I overcome this? Thank you.
Ashley
0 Kommentare
Antworten (2)
Azzi Abdelmalek
am 5 Feb. 2014
Look at this example
x=0:1000
y=sin(x)
plot(x,y)
set(gca,'xscale','log')
Now add xlabel
xlabel('you can do it')
2 Kommentare
Azzi Abdelmalek
am 5 Feb. 2014
Bearbeitet: Azzi Abdelmalek
am 5 Feb. 2014
You probably used xlabel as a variable in your code. Try this to restore the functionality of xlabel
clear xlabel
xlabel('Frequency Hz');
the cyclist
am 5 Feb. 2014
Bearbeitet: the cyclist
am 5 Feb. 2014
Are you able to post a small but self-contained example (i.e. code that we can run) that has everything except the xlabel you want, and describe a little more specifically what you want?
I have a feeling you mean xticklabel and not xlabel.
Here is a trivial example of an xlabel:
figure
semilogx(10.^(1:4),1:4);
xlabel('I am an x-label')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!