Compass plot issue with refreshdata command
Ältere Kommentare anzeigen
I'm having trouble dynamically updating a Compass plot by modifying the variables and then using the refreshdata command to update the plot.
For instance, this simple example below, which is a basic abstraction of what I'm doing, doesn't work as expected:
x = [10 20 15 19]
y = [21 18 14 10]
h = compass(x,y)
set(h,'YDataSource','y')
set(h,'XDataSource','x')
x = [400 300 430 302]
refreshdata
This just results in a blank graph/plot. Is there something obvious I'm missing here?
Thanks for your help!
Antworten (1)
Walter Roberson
am 6 Apr. 2011
1 Stimme
compass() creates one arrow per (x,y) pair, with each arrow being a lineseries object that draws from the origin to the point then to the end of the first barb, back to the point, then to the end of the second barb -- a total of five points per handle. When you set the XDataSource for the collection of handles returned by compass(), if it worked you would be commanding that all of the handles be changed to have their x values exactly the same but with the y values unchanged. That's not likely to be what you want.
The lack of visual update is probably because there would be a mismatch between length 4 of the new x values and the existing 5 y values per handle (5 to draw barbs): if you had happened to use 5 x values in the vector, you'd get some rather odd-looking barbs.
refreshdata() is not useful for commands that draw compound objects on your behalf, only for simple line plots of vectors (not even plot() of a matrix.)
1 Kommentar
Simon
am 10 Apr. 2011
Kategorien
Mehr zu Specifying Target for Graphics Output finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!