Freezing a plot while updating data

Does anyone know if there is an option that is essentially the opposite of drawnow that I can use to tell my plot not to draw until I next call drawnow? I have tried the limitrate flag for this, but that just slows it down which isn't good enough.
I am trying to change the CData of an image and then the colourmap and caxis range, but when I do this normally it briefly shows the new data with the old colourmap and range before flickering and updating fully. Inserting the limitrate drawnow option gets rid of the first problem, but I still get the flicker/jumping as it updates rather than a smooth transition from my original image with one colourmap and caxis range to a new plot with new colourmap and range.

7 comentarios

Pramit Biswas
Pramit Biswas el 6 de Abr. de 2018
Does this link help?
Adam
Adam el 6 de Abr. de 2018
Editada: Adam el 9 de Abr. de 2018
He's trying to do the opposite of me though really and force drawing every time he updates the data. I want to force it to not draw while I update both my data and my axes properties, then force it to draw only after that instead of arbitrarily in the middle of what I want to be an atomic data update process.
Pramit Biswas
Pramit Biswas el 6 de Abr. de 2018
Yes, that's true. I personally not an expert. Is it possible to create the plot handle first, then in a single step update the data (as described in the above link of an answer), so that no reason of flickering occurs? Also can you please check is refreshdata useful?
Adam
Adam el 9 de Abr. de 2018
Yes, I am already updating an existing plot handle, the problem is that I am also changing the axes properties - colourmap and caxis limits and it is this combination that is causing the flickering as it seems whichever order I do it in it redraws in the middle of that process so I either get briefly the old image with the new colourmap or the new image with the old colourmap before getting the end result.
I'm not using refreshdata at all as the image is not linked to a source, I just change the CData of an existing image handle.
Adam
Adam el 9 de Abr. de 2018
Actually I think I have located more what the problem is now. My code is triggering a 2nd call to my plot function (probably when the colourmap range updates) so hopefully if I can stop that from happening that will solve the problem. The plot reacts to a colourmap range slider so I guess that when that slider is being updated either straight after or before the original plotting instruction it is triggering another one as part of its standard behaviour.
Adam
Adam el 9 de Abr. de 2018
It turns out my slider + edit box class had a drawnow instruction in its edit box update function. I added this quite recently in response to some problem of the edit boxes not updating with the slider, but it seems to work fine now without it and my plot doesn't do a double update either which is good! Hopefully I won't find a scenario again where that drawnow was needed.
Pramit Biswas
Pramit Biswas el 16 de Abr. de 2018
Thanks for updates.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Abr. de 2018

0 votos

No, you cannot do exactly that.
The provided way to prevent intermediate updates before you are ready is to set the object (figure probably) visible property to 'off'. Resizing and the like are postponed until the object visibility is turned on again.
Making a figure visible again triggers a drawnow.
If you take long enough to calculate the updated information then something might trigger the figure to disappear (since you did turn it invisible.) My experience with hg1 was that there was a short time window during which if you turned the visibility back on then the figure would not flicker off and back on.

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 5 de Abr. de 2018

Respondida:

el 16 de Abr. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by