Error in histogram plot including datetime
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!
I want to plot a histogram in a plot which x-axis is a datetime vector. However i got this error:
Error in histogram (line 145)
[opts,passthrough,dispatch] = parseinput(args,firstaxesinput);
here is my code:
histogram(run(1:12), D1.Date(1:12));
the run vector is double and D1.Date is a datetime vector.
12×1 datetime array
1999-12-31
2000-01-03
2000-01-04
2000-01-05
2000-01-06
2000-01-07
2000-01-10
2000-01-11
2000-01-12
2000-01-13
2000-01-14
2000-01-18
any solution would be much appritiated.
0 Commenti
Risposte (1)
Star Strider
il 20 Gen 2019
You already appear to have the data you want to plot, so histogram may not be the correct choice.
Try this instead:
figure
bar(D1.Date(1:12), run(1:12))
That will plot your data to look like a histogram plot.
0 Commenti
Vedere anche
Categorie
Scopri di più su Histograms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!