フィルターのクリア

Plot with scale and adjusted

6 ビュー (過去 30 日間)
Paulo Oliveira
Paulo Oliveira 2013 年 10 月 18 日
コメント済み: Paulo Oliveira 2013 年 10 月 18 日
Hi, I need do a plot with y scale but that adjust this scale automatic. Anyone help me?
Example (adjust but without scale in y scale):
if true
% {subplot(5,2,3)
plot(per_mg,'-*k')
set(gca,'Position',[0.1, 0.68, 0.31, 0.10])
axis tight
set(gca,'YTick',10:10:60)
set(gca,'XTick',0:1:4)
set(gca,'XTickLabel',{'','1T','2T','3T','PP'},'Fontsize',6)
xlabel('Momento Estudado','Fontsize',6);
ylabel('%','Fontsize',6);
title('Percentagem de massa gorda','Fontsize',8,'FontWeight', 'Bold')} end
Example (manual adjusted but with scale in the y scale):
if true
% {subplot(5,2,3)
plot(per_mg,'-*k')
set(gca,'Position',[0.1, 0.68, 0.31, 0.10])
axis [1 4 10 60]
set(gca,'YTick',10:10:60)
set(gca,'XTick',0:1:4)
set(gca,'XTickLabel',{'','1T','2T','3T','PP'},'Fontsize',6)
xlabel('Momento Estudado','Fontsize',6);
ylabel('%','Fontsize',6);
title('Percentagem de massa gorda','Fontsize',8,'FontWeight', 'Bold')}
end
  2 件のコメント
Jan
Jan 2013 年 10 月 18 日
Please use the [{} Code] button to format the code. Currently it is not readable. The question is not clear yet: What is "plot with y scale" and what should be adjusted automatically.
Paulo Oliveira
Paulo Oliveira 2013 年 10 月 18 日
With first example, my plot in ylabel don't see the scale.
In second example I see the scale (10:60) but the plot is not adjusted.
I want a plot as the first example but with a scale similar of the second example. Already, do you understand me?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2013 年 10 月 18 日
I see scales along the x and y axis of the plots you included - meaning there is a line along the axis and tick marks and tick labels (that you specified custom labels for). So, if it's not that then what do you mean by scale? Do you mean grid lines going across the white space of the plot? If so, use
grid on;
Or do you mean the width of the plot? If so try
width = 0.75; % Fraction of the figure width
height = 0.25; % Fraction of the total figure height.
set(gca, 'Position', [0, 0, width, height]);
Of course you can specify whatever width and height you want.
  1 件のコメント
Paulo Oliveira
Paulo Oliveira 2013 年 10 月 18 日
I am so stupid, I put a set in ytick with limiters and my plot do not adjusted automatic and already I see the numbers in the y scale. Sorry and thanks for the answer.

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2013 年 10 月 18 日
編集済み: dpb 2013 年 10 月 18 日
This looks like the same question I answered yesterday in the newsgroup --
You're adjusting the [X|Y]tick and [X|Y]ticklabel properties but those are independent of the [X|Y]lim properties that control the actual axis values.
You did
set(gca,'YTick',10:10:60)
but instead you're looking for
ylim([10 60])
or
set(gca,'Ylim',[10 60])
Then you can adjust the ticks and labels if you wish/need to...
Read background information on the handle graphics axes object for more details on how axes function and the various properties.
ADDENDUM:
On the "automatic" scaling, don't manually set limits or use hold on -- the default is for plot to autorange. When you make the changes in the default properties, however, then the associated '...Mode' property is set to 'Manual' from 'Auto'

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by