Plotting: How can I remove the axis label and only have it at points of my choice?

2 ビュー (過去 30 日間)
Ines
Ines 2012 年 7 月 9 日
I have created a plot:
data=[0.0308058510638298; 0.596862338112858;0.861890893648603; 0.673247180006754; 0.409382760478123; 0.157375455092607; 0.301794976611568]
maximum=3
x=0:0.01:maximum;
[a,b] = unifit(data)
y=unifpdf(x,a,b);
area(x,y)
axis([0 maximum 0 2])
xlabel('energy consumption')
title('Fit to uniform distribution')
now I would like to remove the numbers on the axis label and only have it on the y axis at the max value (i.e. at y= 1/(b-a)) and at the x values a and b (see example)
How can I do this? Many thanks in advance!

回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 7 月 9 日
set(gca, 'XTick', [a b], 'YTick', max(y(:)) );

Luffy
Luffy 2012 年 7 月 9 日
If you mean axes Tick Label at end of your code write this,
set(gca,'YTickLabel','||||||1.2')
set(gca,'XTickLabel','0.0308||0.8619|||||')

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by