필터 지우기
필터 지우기

Addaxis function with bar plot added

조회 수: 5 (최근 30일)
Eileen Lukens
Eileen Lukens 2020년 3월 13일
댓글: riccardo scandroglio 2021년 5월 10일
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일
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).
  댓글 수: 1
riccardo scandroglio
riccardo scandroglio 2021년 5월 10일
Hi Gaurav,
could you please provide an example?

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

카테고리

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