GUI Layout Toolbox - Strange display with card panel object - matlab

Context
Using the GUI Layout toolbox I have created an interface which basically is divided in two parts:
A toolbar area where the user selects the way he want to see data
A preview area to display data upon selected mode in the toolbar
For the preview area I used a uietxras.CardPanel object to switch between the view modes.
Problem
After some investigations, I discovered that if I display things in 3D (or 2D) in one of the preview card using surf (or pcolor) then it alters the display in the second card. If I display data in 1D only using plot commands I have not issue!
The issue I have when using pcolor/surf in one of the preview card:
Titles and labels seem to overlay in Preview 1
Axis borders are not displayed correctly in preview 2
Legend borders (when displayed) are altered also
If I only use plot commands in both preview modes I have no issue at all and cards are switching nicely.
Test case
My real code is really long, I have thus reduced it to the minimum so you can reproduce the issue:
https://gist.github.com/CitizenInsane/54f3c1eba2293d0e5264#file-guilayoutbug-m
Simply run the code and check the checkbox "Do 3D plot in preview 1" to see the issue happening when switching between the two preview modes:
Notes
As far I know, I'm using latest version of the GUI Layout toolbox (1.17).
I'm using R2013b for Matlab

I came across this issue as well. I'm afraid I never quite worked out what the cause was exactly, and it didn't appear in a very consistent way. The issue seems to be that plots on non-selected cards are not hidden properly, and get overlaid just behind and around the edges of the plots on the selected card.
I would encourage you to raise the issue with the authors of GUI Layout Toolbox via the comments on the toolbox's page at MATLAB Central, as I do think it's a bug.
Nevertheless, the reason I never followed it up myself is that I found a fairly straightforward workaround, which may also work for you. Each time the selected card is changed, I ran a simple function that deleted all children of all cards, and then re-plotted whatever I wanted on the selected card. It seemed a bit annoying to have to do that, but it worked, and removed any of the display issues you've come across.

Ok got it, the issue has nothing to do with CardPanel themselves, it is linked to the renderer of the figure.
Trying simple code below:
figure(42);
subplot(1,2,1);
plot(rand(1,12));
subplot(1,2,2);
peaks;
shading flat;
If the figure's renderer is set to 'OpenGL' (the default) ==> there are some glitches:
If the figure's renderer is set to 'zbuffer' ==> there is no glitch:
Setting the renderer to 'zbuffer' fixes the problem.
NB: Maybe OpenGL rendering can be fixed by fine tuning graphic card acceleration settings, but I don't know ... I issued opengl software and opengl hardware commands in Matlab and software rendering is worst than hardware rendering on my machine.
EDIT: Side notes
Transparency effects are only available if the renderer is set to 'openGL'. It is thus not possible to visualize at the same time both 1D and transparent-3D data without glitches (at least with hg version 1 in R2013b).
HG2 has no issue:

Related

Make grid visible with imagesc (Linux software opengl)

I'm talking about the grid() command, not the previously asked and answered questions about showing lines around pixels (data cells). My image is of scientific data that has relevant axes and I would like the grid to overlay on the image plot. When I call grid(), the grid is there, but imagesc() covers it up. I can see it if I change the alpha of the image, but then the image looks grayed out. Is there another option?
EDIT: Here's an example of what I want. It turns out that it works just fine on my Windows machine, but my linux box shows no grid lines as described above. The linux machine uses software opengl. Any workarounds?

Mapbox Studio - layer ordering / z-index

I am following the source quickstart tutorial. I have followed the tutorial all the way through, and am having trouble displaying the earthquake data (red circles) above the land vectors.
According to the symbol drawing order documentation:
“Higher” layers obscure “lower” ones.
However I'm not finding this to be the case. Please see attached screenshot:
The 'earthquakes' layer is the 'higher' layer, I think. I am using the 'Comic!' base map styles. Since the road lines also appear to 'mask off' the land vectors and show the earthquake data below, I'm wondering if this is causing the issue, but looking through the styles there's nothing obvious I can see.
Thanks for any help.
The documentation is correct, however the comp-op family of CartoCSS properties affect how the colors of different layers interact with each other. In this case, the marker-comp-op: screen from the quickstart example was designed to work well over a darker satellite background, but becomes nearly invisible over solid white.
If you remove the marker-comp-op property or change it to a different compositing operation such as multiply the earthquake markers should show up fine.

Figure tools not working when overlaying a transparent image

When overlaying one image on another using hold on and transparency (the 'AlphaData' property), figure tools such as zooming in and the data cursor are not working properly.
This can be seen, for example, in the Marker-Controlled Watershed Segmentation example, by running ipexwatershed. The last figure of the example looks like this:
Using the zoom-in tool on the figure sometimes works, and sometimes results in an invisible figure, though the data is still there, as can be seen by using the data cursor. The data cursor itself behaves somewhat strangely, though it is usable. The black square and tooltip background of the cursor disappear, and only the text is seen.
This issue has already been raised on MATLAB Central a year ago, but no solution is provided there.

MATLAB: Bug in plot function

I wrote some code at home to plot some 3D-data. It worked fine. Now I ran the same code at the office and I got some weird bug. It seems that there is a label for each data point inserted.
But this only happens on half of the plots. The left plot shows the real data and the right one is just a smoothed fit of this data. The left one gets the error and the right one doesn't.
I ran the code on the machine of a colleague and it worked fine too. So I saved the clean figure files on his machine and tried to open them on my PC. Still the same bug. So it's not the code but seems to be some weird displaying bug.
Did anyone see this before?
figure(1);
s1=gca;
surf(t_matrix,f_matrix,alpha_matrix)
colorbar
figure(2);
s2=gca;
surf(t_matrix2,f_matrix2,alpha_matrix2)
colorbar
It's just this code. And if I debug, the numbers appear after the first call to colorbar. But not in the second case. My Matlab version at home is 2013a, but at the office and that from my colleague are both 2012b.
This seems to be a bug. There is a thread on MATLAB Answers.
The accepted answer there by Jan Simon is
This could be cause by the OpenGL driver. Did you install the newest
drivers of your graphics cards?
Workaround might be:
set(gcf, 'renderer', 'zbuffer');
or if OpenGL looks nicer:
opengl software
or perhaps:
opengl hardware
Look for "OpenGL" in the documentation to find a bunch of switches to
consider a bunch of driver bugs.
Actually the zbuffer renderer works fine but is not enough in some cases.
I often use to work with transparent surface plot using the gca property facealpha set to 0.5 in order to superpose a contour plot to it. Face or edge alpha settings (maybe some other plot properties) are only correctly displayed with the Opengl renderer. The zbuffer cannot picture transparent surface plot.
The main issue first came to my attention when I recently switched to Win8. Bloody $Bill 'HamsterWhy' Gate.
A patch from Mathworks would be greatly appreciated.

Page Flashing On Scroll

Any ideas why this page: http://mpdteam.net/projects.html is flashing when it scrolls? I've determined it's due to the background of the main content container, but why? is it a eye-trick, an image flaw, a browser flaw, or a code flaw? The code is easily viewable with view source or dev tools.
Let me know if you need anymore info. thanks.
(also, feel free to re-tag. i'm having a mind-blank for good tags)
It's because it uses finely spaced grey and white lines.
It is perhaps an example of the Moiré pattern, although this is more typically reserved for two overlapping grids at different angles.
I always assumed on a PC this occurred because of the redraw time between the two colours, and how finely spaced the lines are. The lines not perfectly aligning with pixels (e.g. anti-aliasing) would further enhance the flickering effect.
To fix it, try changing the size of the bands (e.g. try zooming out or in on the current page, and moving the browser, and note how you get reduced and even none of the described flickering effect).
Alternatively, you may want to apply a blur such that the difference between bands was softened (not sure if this would necessarily help).
Another suggestion that research yields is that it is due to background redrawing/scaling. However, a fixed background (as compared to a repeating one) isn't particularly applicable to your page.
In any case, for an in-depth discussion of some of the concepts involved, check out this awesome page (http://www.techmind.org/lcd/)