matlab figure turns to gray

Hi,
I have pretty old matlab (R14 SP3). When I perform the plots on specific case, the figure changes to grey and all the data is disappered (except the legend).
Unfortenutly I can't share the figure, as it is on other network computer.
1. Any idea what could be the issue?
2. As part of trouble shooting, I'd like to export all the properties from the figure to the file before the command and after the command and compare.
How can I do that?

15 Commenti

DGM
DGM il 27 Dic 2021
Without specifics, it's hard to guess what it might be. I'm only familiar with versions back to about R2009. I assume that's old enough to establish common ground, but without even knowing what sort of plotting operations are being perfomed, I can't say.
As with all cases, if you can't share your specific data, try to make a sufficiently generalized minimal working example that can be used to demonstrate the problem. Oftentimes, the act of trying to create such an example serves as a troubleshooting process in itself.
I do have a program that can dump attributes of handle graphics objects to text, but I have never tested it on a version that old. Also, I just now dug it out of my backups after a major file corruption last year, so I have not had an opportunity to review it to see how much progress I lost on it. I would probably need the .fig file to work with though.
At one point I had a way to compare two graphics objects, but I may have lost that. Comparing would be more appropriate for your purposes than just dumping and hoping to figure out the differences from the (long!) text.
michael
michael il 27 Dic 2021
@Walter Roberson I'be be glad if you can share one
I have not released the code to the public... especially not the rescued version of the code, which I would have to examine to see what it is missing.
Hmmm, now how did I implement comparing two objects... I don't remember now.
dpb
dpb il 27 Dic 2021
I'd probably instead start with a debug session and step through and find which specific plotting command causes the issue to appear...
michael
michael il 27 Dic 2021
I'm using fill function inside a for loop. (I have to draw large set of data) At some point in a for loop I have this scenario
dpb
dpb il 27 Dic 2021
Modificato: dpb il 27 Dic 2021
So, that pretty well 'splains what's happening -- at some point your colors/fill command covers the screen.
You can use a binary-divide scheme to stop the loop in halves -- does it happen in first half or second? Rinse and repeat; won't take long to isolate just where it occurs. Knowing that, the "why" then shouldn't be too hard to ascertain.
If, as you describe, the problem only occurs on a given figure and not on a bunch of others, it would almost certainly end up being data related -- either a value is not in a range expected or you're not handling a branch/edge case inside the loop for a given piece of the data or somesuch.
Still, the first thing is to find out which piece(s) of data is(are) the one(s) causing the symptom.
dpb
dpb il 27 Dic 2021
Alternatively, instead of searching the code first, compare the input data sets for one that doesn't cause the problem and the one that does...that may uncover the problem with the dataset more quickly if something sticks out there.
Having no klew of what you're actually doing nor what the data might be, it's pretty tough to do more than generalize.
fill() will not draw anything if any of the coordinates are NaN or inf, if I recall correctly.
michael
michael il 28 Dic 2021
Modificato: michael il 28 Dic 2021
my code looks like:
if (size(table,1))
for i=1:size(table,1)
ll=fill([table(i,1) table(i,2) table(i,2) table(i,1)], [-0.1 -0.1 0.5 0.5], [255 229 204]/255)
end
end
The problem occures when i=97
The table is fine (the values in the table are either [x, x] or [x x+y])
michael
michael il 28 Dic 2021
Can it be related that there are max number of plots that could be done for the whole figure?
My figure contains 2 subplots which are more or less the same (the for is existing for both of them).
x = 1:10;
y = randi(9, 1, 10);
fill(x, y, 'r')
title('finite')
figure
y(5) = nan;
fill(x, y, 'r')
title('nan')
Carrying on from Walter's example, try adding
if (size(table,1))
for i=1:size(table,1)
assert(all(isfinite(table(i,1:2))),'table contains non-finite values at %d,i')
ll=fill([table(i,1) table(i,2) table(i,2) table(i,1)], [-0.1 -0.1 0.5 0.5], [255 229 204]/255)
end
end
This will throw an error and tell you which i value it is that is either NaN or Inf if that is the issue as I suspect along with Walter it is....or you could issue a warning instead or do a global test and report first.
michael
michael il 28 Dic 2021
I don't have undefined values.
dpb
dpb il 28 Dic 2021
Either show us an image or explain more throughly what the image looks like -- my initial reading of your description was the whole figure area turned gray; wasn't thinking about the lack of fill and the lines still being drawn and being shown as Walter illustrated.
Is the figure filled or open? If it is open, that's conclusive proof of either there is a non-finite value in the values table or the figure doesn't close.
The other way besides to leave nothing but a line would be for table(i,1)==table(i,2) which is a degenerate area or line.
I think we've gone about as far as is possible without a dataset that illustrates the problem.
As far as the Q? about the number of objects, you can always test by changing your loop index to start at, say, 90 instead of 1 and see if you get past the 97th dataset without the issue occurring -- I'm betting it still will show up because it is actually data-related.

Accedi per commentare.

Risposte (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 28 Dic 2021
Modificato: Sulaymon Eshkabilov il 28 Dic 2021

1 voto

(2) To export all figure properties can be done via File --> Exort Set Up ...
You may also consider to Gnerate a fcn file that will contain most of the plot options from the current figure:
File --> Gnerate a Code

1 Commento

michael
michael il 28 Dic 2021
Generating the code, I see that there no difference at all excpet the new record.

Accedi per commentare.

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange

Prodotti

Release

R14SP2

Richiesto:

il 27 Dic 2021

Commentato:

dpb
il 28 Dic 2021

Community Treasure Hunt

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

Start Hunting!

Translated by