How to set the datasource of a histogram programmatically?
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (2)
Bhuvnesh Singh
el 2 de Mzo. de 2018
0 votos
Hello Raptrick,
Yes the YDataSource' property is not available for histogram object.
For a workaround you can follow the below link:
1 comentario
Raptrick
el 2 de Mzo. de 2018
Adam Nekimken
el 13 de Jul. de 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
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
