Info

This question is closed. Reopen it to edit or answer.

Plotting in groups by two variables?

1 view (last 30 days)
Iris Li
Iris Li on 15 May 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
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

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!