Zooming in an extra axis?

4 ビュー (過去 30 日間)
lightworks
lightworks 2013 年 3 月 12 日
Hi!
I have problems in zooming in my plot once it's done (in the Plot window that pops up as an output). I wanted to add a grid to my plot, but only in the horizontal lines and with a lighter color than the default one. I found somewhere in the Internet that the solution was to make an auxiliary axis, and the code for it. So far so good, but when zooming in my plot, i only get a zoom in the auxiliary axes and not in the ploted curves.
Here's what my figure looks like
and here's how it looks after zooming on it:
So, as you can see, the curves didn't get any zoom.
Here's my code (X is my matrix with the data):
cc=jet(6);
figure;
hold on;
month=[1:12];
for i=1:5
plot(month',X(:,i),'color',cc(i,:),...
'LineWidth',2);
pbaspect([1.7 1 1]);
xlim([1 12])
set(gca,'XTick',1:1:12)
set(gca,'XTickLabel', 'E','F','M','A','M','J','J','A','S','O','N','D'})
ylabel('Tmax (ºC)')
xl=xlabel(stid(k));
set(xl,'FontSize',12);
set(t,'Fontsize',12);
legend('Media','Mediana','Análogo1','Pesado','Azar',3);
end
hold on;
B=gca;
C = axes('Position',get(B,'Position'), ...
'Color','none', 'TickLength',[1e-100 1e-100], ...
'XGrid','off', 'YGrid','on', ...
'Box','off','YColor',[0.5 0.5 0.5], ...
'XTickLabel',[], 'YTickLabel',[], ...
'XTick',get(B,'XTick'), 'YTick',get(B,'YTick'), ...
'XLim',[1 12], 'YLim',get(hAx1,'YLim'));
pbaspect([1.7 1 1]);
Any ideas on why is this happening?
Thanks in advance!

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 3 月 12 日
You should not need a second axis. You should just need to set XGrid off and YGrid on.
  3 件のコメント
Walter Roberson
Walter Roberson 2013 年 3 月 12 日
Configure the new axes to have HitTest off.
lightworks
lightworks 2013 年 3 月 13 日
編集済み: lightworks 2013 年 3 月 13 日
It's not working. I added
set(C,'HitTest','off');
at the end of the code.
Is that what you ment?

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

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by