Line disappearing when zooming in a UIFigure
4 次查看(过去 30 天)
显示 更早的评论
Daniel Ko
2019-8-31
Hello,
I am using appdesigner to create a way to scan through my time series. When I zoom into the time series however, the line disappears and only comes back when I jiggle around with the pan tool for a while or zoom all the way out using the home button in the interactive plot tool.
Is there a way to stop this from happening? I believe this is something to do with some under-the-hood optimisation going wrong?
After zoom:
Thanks!
21 个评论
dpb
2019-9-1
Need to see the code but one Q? Are you using two axes to show the points and the line by any chance? Zooming the one but not the other could end up w/ the second being brought to the foreground and occluding the first. Just a guess w/ nothing else to go on...
Daniel Ko
2019-9-1
I am using the same UIAxes to plot both the lines and the markers. The line does come back eventually if I jiggle the zoomed axes with the pan tool for a bit and the line and the markers do jiggle together so its not that I think.
% blue line
app.pData = line(app.Trace, app.msConvert*(1:size(app.xi,2)),app.xi(app.m.mainCh,:),'Color','b');
hold(app.Trace, 'on')
for ii = app.s.clusters
tempUnit = app.rawSpikeIdx(app.t.spikeClust{app.currentBatch} == str2double(ii));
if ~isempty(tempUnit)
nii = str2double(ii);
% markers with different colour each loop
app.pAssigned(c) = line(app.Trace, tempUnit*app.msConvert, app.xi(app.m.mainCh,tempUnit), ...
'LineStyle', 'none', 'Marker', 'x', 'Color', app.cmap(nii,:));
c = c+1;
end
end
dpb
2019-9-1
Try sticking a drawnow in there somewhere -- I've never done much programmatically w/ zoom and never used UIAxes so am guessing here. Is there a callback for the zoom operation, maybe? Be a place to put it if so...
Daniel Ko
2019-9-2
I am hesitant to add a drawnow to the zoom function (matlab builtin). Not sure where I'd put it if not in there.
dpb
2019-9-2
No, you don't add anything to the ML function, you use one of the builtin callbacks from modifying the figure and put it in your callback function. As said, I've never used UIAxes nor zoom programmatically so I'm not sure just what options are out there, but I'd wager there are some.
Daniel Ko
2019-9-3
It seems like the zoom function does not support UIAxes to have zoom callback functions at this time. Is there a workaround?
Adam Danz
2019-9-3
编辑:Adam Danz
2019-12-12
Interactive zoom does work with uiaxes - that's how you zoomed into your axes in the first place.
When you zoom in and the lines disappear, you could execute drawnow() from the command window just to test dpb's hunch that it's a graphics glitch.
If the problem is very easy to reproduce, you could attach the app file & data and instructions how to reproduce the problem. Otherwise, maybe move on to tech support.
[update]
Also see this summary of zoom methods in App Designer
Daniel Ko
2019-9-3
I tried the drawnow command in the command window and it does not solve the problem. I will try the tech support.
lihiniya
2019-9-11
编辑:lihiniya
2019-9-11
I have the exact same problem. I use uiaxes component in app designer and plot a line with considerable large data (1 million or more points). The plot sometimes disaapears when zommed with interactive controls or even when setting XLim manualy. This does not happen always but I cannot find a pattern. If i pan around or zoom-out completely or set the XLimMode='auto' the plot comes back most of the time.
This happens in multiple computers with different hardware (for an example a workstaion with Nvidia graphics and a PC with Intel HD graphics). Does this have someting to do with app designer web gui not handling the large number of data points? AFAIK app designer apps run inside a built-in web-browser with some sort of java-script UI widgets.
Matlab Version 2019a update 5. Has been happening even when I used 2018b.
@Daniel Ko: Were the tech-support able to solve your problem?
Bruno Luong
2019-9-11
编辑:Bruno Luong
2019-9-11
Hmm, I suspect that there is a huge latency in refreshing, and when you zoom in lines are YET nor drawed, so you have impression that they disappear.
After 5 years of existence, HG2 still has big slowness problem with plotting huge number of markers.
I even observe the tendency that the latency gets more pronounced when user zooms IN (where there is less things to displayed on the screen) !
dpb
2019-9-11
Does the latency show up as inability to do other operations or just the graphics display in background, Bruno?
IOW, is there a way for OP to tell this is the cause?
Bruno Luong
2019-9-11
Hard to tell, because I think MATLAB graphical rendering is in charge by an independent thread and can be triggered by various factors (drawnow is one) and also dependend on the interrutible/busy states of the graphic objects or figure.
The slowness might also depend on zbuffer/painter rendering, perspective or parallel (2D) projection.
Quite a complex beast.
In the worse case I prefer to kill MATLAB (like I just did by playing with some script related to this question).
dpb
2019-9-11
That's kinda' what I was suspecting...not easy to determine root cause.
I've not done anything "in anger" that required really large datasets to have much (as in any) experience with HG2 since I retired from active consulting gig about the time it was introduced. I just piddle here and with some much smaller non-engineering/graphics datasets in some pro bono work these days...
Stephanie
2019-12-12
I'm having a similar issue. I have 5 lines plotted. When I click on a line circle markers are created showing which values where clicked on. When fully zoomed out you can see the lines and the circle(s). But when I zoom in I can still see the lines but the circles vanish. I have not found anything that makes them reappear while zoomed. But if I click the "house" or restore view icon the circles reappear.
Also if I click the zoon in icon. And then unclick it. It does not turn zoom in off. But this does work for zoom out and pan. The zoom in is a problem because after zooming in I would like to click on the line and have the circles be added to the line. But because I can not get zoom in to turn off, when I click on the line it just zooms in again.
Very frustrating.
Steph
Stephanie
2020-3-11
I am having a similar issue. I was able to get a zoomed in view with the symbols still visible by setting the ylim for the axes in the function that runs when I click on the line. But they quickly disappear when you zoom out or try and mess with the zoom in or out. I am going to redo this whole GUI in the good old guide because I need to be able to zoom and see the symbols. It is the way I remove spikes etc and is 90% of the functionality that I need from the GUI. Also the way the app Designer handles clicks makes it hard to do what I am use to being able to do in the guide version of GUIs.
Steph
Stephanie
2020-3-27
r2019b. I've been trying to get help from Matlab but they keep thinking the WindowButtonDownFcn callback is running and deleting the dots. But it is not. I have a lot of display scripts to show it is not running when it is not suppose to. But they keep thinging that is the issue and it is not.
I have tried to do some of their suggestions, like remove the axes toolbar and make a zoom on off button. And I make sure the callback does not run when the zoom is on. An now the problem is worse. Once you zoom in the dots disapear and nothing I do can make them come back. when I had the toolbar the home button made them reappear. Now zooming out full does not make them appear and click on another line correctly runs the plotting function and the x and y data look fine but the dots never show up. So following their suggestions have made it worse not better.
So frustrating. Steph
Stephanie
2020-3-30
An update, I put in a Technical Support report about the issue. After some back and forth they finally figured it out and the dissapearing dots when I zoom no long vanish! I had set the Zdata of the dots to 30 and they suggested 0.9 and they also noted that the 'SortMethod' on the axes was "depth" and I should change it to be "childorder". I am not sure how the 'SortMethod' got to be "depth" because I did not set that property. But doing those two things made my dots stay put when zoom in and out and using the toolbar home item. Hope this helps!
Steph
Daniel Ko
2020-5-22
I am not, the new 2020a update fixed the issue among a lot of other speed improvements.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)