Surfl chart; datetime on y-axis, letters on x-axis

1 次查看(过去 30 天)
Hi, i am trying to make a 3d surface chart (surfl) out of a x-by-y table named 'cum_pl', which contains daily P&L numbers for x days and for (y-1) markets. The table contains dates of DateTime type in the first column (column header = 'Date'). The table contains the Ticker symbols in the header row (cum_pl.Properties.VariableNames). The rest of the matrix contains the daily P&L for each market, for each day.
I use surfl(cum_pl{:, 2:end}) to initially plot the P&L figures in a surface chart. However, i can't seem to manage to show the datetimes on the y-axis (e.g.,format 'dd-mm-yy'), and the tickers on the x-axis, using the YTick, YTickLabel properties of the gca object.
See a small picture of the cum_pl table attached. I am using Matlab 2016a.
Hope someone can help out, thanks in advance!
Steven

采纳的回答

Peter Perkins
Peter Perkins 2017-2-13
surf supports datetime in R2016b, but not in R2016a.
In 16a, you can convert datetimes to datenums and use datetick, or you can set the tick locations yourself and assign the labels by converting the datetime to text using cellstr.
Hope this helps.

更多回答(1 个)

dpb
dpb 2017-2-10
Be simpler if you'd attach a subset of the data itself but you've got to give the X, Y axes values to plot against to get dates. I've no idea if surfl is datetime-aware or not, but give it a go and see...
surfl(cum_pl{:,1},[1:size(cum_pl,2),cum_pl{:, 2:end})
Then use 'yticklabel' property to set the ticker symbols. I'd guess you're going to run out of room to display all the symbols for every column, though...

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by