How to set the datasource of a histogram programmatically?
Mostra commenti meno recenti
Hello all,
Does anyone know how to set the datasource of a histogram?
figure;
data = randn(10,1);
h = histogram(data);
linkdata on
h doesn't have a YDataSource property. It looks for me that you can only set the datasource manually in the figure.
Patrick
Risposta accettata
Più risposte (2)
Bhuvnesh Singh
il 2 Mar 2018
0 voti
Hello Raptrick,
Yes the YDataSource' property is not available for histogram object.
For a workaround you can follow the below link:
Adam Nekimken
il 13 Lug 2018
Hi Patrick,
I was having the same problem, and I think I found a workaround. First, run your script and do the manual linking, then save the figure. The next time you run the script, open the saved figure and call linkdata:
open(linkedFig.fig)
linkdata on
The figure retains the data link it had before, at least in my script. I've only tested this a bit, but it looks to have solved the problem for me.
Adam
Categorie
Scopri di più su Data Distribution Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
