Surfl chart; datetime on y-axis, letters on x-axis
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Steven Niggebrugge
am 10 Feb. 2017
Beantwortet: Peter Perkins
am 13 Feb. 2017
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160568/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Peter Perkins
am 13 Feb. 2017
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.
0 Kommentare
Weitere Antworten (1)
dpb
am 10 Feb. 2017
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...
0 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!