Addaxis function with bar plot added

I'm using the 'addaxis' function to add a third y axis to my plot. However, I want my third plot to be a bar plot instead of a line plot. Is there anyway to change this?
Here is the addaxis function:
for i = 1:3
subplot(3,1,i)
name=ComboName(i);
plot(TCD,Combo(:,i),'.k')
xlabel('Date')
ylabel(['C of ', num2str(name)])
ax=gca;
ax.YColor='k';
hold on
addaxis(TQD,Q,'.b')
addaxislabel(2,'F')
hold on
addaxis(time2,rain,'r')
addaxislabel(3,'P')
datetick('x','mm/yyyy')
end

댓글 수: 1

dpb
dpb 2020년 3월 14일
Dunno, and not going to install to test...but you should be able to retrieve the current axes and do whatever in it directly. Unfortunately, also looks like does NOT return the line handles to the created line in the new axes so you'll have to go handle-diving to retrieve it to delete it...
Why not create the bar plot first instead?

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

답변 (1개)

Gaurav Garg
Gaurav Garg 2020년 4월 30일

0 개 추천

Hi Eeleen
You can use bar function to plot bar on the third axis.
To plot bar, you need to give in axes as the first argument (documentation).

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2020년 3월 13일

댓글:

2021년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by