フィルターのクリア

Addaxis function with bar plot added

5 ビュー (過去 30 日間)
Eileen Lukens
Eileen Lukens 2020 年 3 月 13 日
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 Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by