Compass plot issue with refreshdata command
5 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
Walter Roberson
2011-4-6
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.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!