Info

此问题已关闭。 请重新打开它进行编辑或回答。

Plotting in groups by two variables?

1 次查看(过去 30 天)
Iris Li
Iris Li 2018-5-15
关闭: MATLAB Answer Bot 2021-8-20
1.How should I plot strike_price to mid_value grouped by date and by maturity? i.e. I would like to get 4 plots with label "date:20160418;maturity:1","date:20160418;maturity:2","date:20160419;maturity:1","date:20160419;maturity:2". 2.Another two plots with 2 lines each. i.e. plot A:"date:20160418;maturity:1","date:20160418;maturity:2" and plot B:"date:20160419;maturity:1","date:20160419;maturity:2". Thank you in advance!!!!!!
date = {'20160419';'20160419';'20160419';'20160419';'20160419';'20160419';'20160418';'20160418';'20160418';'20160418'};
cp_flag = {'C';'C';'C';'P';'P';'P';'C';'C';'P';'P'};
maturity = [2;2;1;2;2;1;2;1;2;1];
strike_price = [40;30;20;40;30;20;40;30;40;30];
mid_value = [0.021; 0.022; 0.033; NaN; 0.025;0.026;0.027; 0.028; 0.039; 0.041];
T = table(date,cp_flag,maturity,strike_price,mid_value)
T =
10×5 table
date cp_flag maturity strike_price mid_value
__________ _______ ________ ____________ _________
'20160419' 'C' 2 40 0.021
'20160419' 'C' 2 30 0.022
'20160419' 'C' 1 20 0.033
'20160419' 'P' 2 40 NaN
'20160419' 'P' 2 30 0.025
'20160419' 'P' 1 20 0.026
'20160418' 'C' 2 40 0.027
'20160418' 'C' 1 30 0.028
'20160418' 'P' 2 40 0.039
'20160418' 'P' 1 30 0.041

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by