change scales from the x axis

조회 수: 1 (최근 30일)
Locks
Locks 2013년 5월 2일
Hi,
I intend to do a chart with two yaxis, the code is the following:
dates=datenum(dataSet(:,1));
%SPX
SPX=dataSet(:,2);
%VIX
VIX=dataSet(:,3);
plotyy(dates,SPX,dates,VIX);
%datevc divides the date in different columns, first colum is the year,
%second the month and thrid the day
d=datevec(dates);
%Takes just the year (first column)
d=d(:,1);
%takes every year just once
[a,idx]=unique(d(:,1),'first');
ylabel('VIX');
set(gca,'xtick',dates(idx),'xticklabel',a)
ytix = get(gca,'YTick');
set(gca,'YTick',ytix(2:end));
This is working but unfortunately besides the years I have also the numeric date displayed on the x axis, how can I change that?
is there a way to make both y axis black instead of blue and green?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 2일
use
[ax,h1,h2]=plotyy(dates,SPX,dates,VIX);
set(ax(1),'ycolor','k')
set(ax(2),'ycolor','k')
  댓글 수: 11
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 2일
set(ax,'xlim',[min(x) max(x)])
Locks
Locks 2013년 5월 2일
perfect, thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by