Graphic problem on windows, but ok on Linux

3 views (last 30 days)
I made a macro to format and display 3d values on graphics (using contourf or surfc). in my case, the 3d are : -x axis : time -y axis depth -z axis (the color intensity) : physical value
The macro work perfectly and fully with a computer (configuration 1), but the same macro don't work on another computer (configuration 2). I tried a lot of things to resolve it, but I can't find a solution: opengl hardware, opengl hardware, set(gcf(), 'Renderer', 'painters'), set(gcf(), 'Renderer', 'zbuffer') ... mean to the same error messages.
Is a Open GL problem ? Is it an hardware problem ? Is it a code problem ?
The format and data are good because it work perfectly on configuration 1, but in some case (some data sets): surface or contour graphic can't be done (figure is made but crash) and the error message is (I tried with contourf and surfc) :
Error using contourf (line 61) Vector X must be strictly increasing or strictly decreasing with no repeated values.
That refers to (in contourf.m) :
if (nout == 3)
warning(message('MATLAB:contourf:EmptyV6OutputArgument', upper( mfilename )));
end
try
if nout == 0
contourfHGUsingMATLABClasses(cax, args{:});
elseif nout == 1
cout = contourfHGUsingMATLABClasses(cax, args{:});
else % nout == 2 || nout == 3
[cout, hand] = contourfHGUsingMATLABClasses(cax, args{:});
end
catch me
throw(me)
OR :
Error using surfc (line 21) Vector X must be strictly increasing or strictly decreasing with no repeated values.
That refers to (in surfc.m) :
if ishg2parent( varargin{:} )
[~, cax, args] = parseplotapi(varargin{:},'-mfilename',mfilename);
try
if nargout > 0
h = surfcHGUsingMATLABClasses(cax, args{:});
else
surfcHGUsingMATLABClasses(cax, args{:});
end
catch me
throw(me)
end
configuration 1:
Linux x64
Matlab 2013a
Rendered : zbuffer
'opengl info' result:
%
Version = 4.4.0 NVIDIA 340.96
Vendor = NVIDIA Corporation
Renderer = GeForce GT 610/PCIe/SSE2
MaxTextureSize = 16384
Visual = 0x6f (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
Software = false
# of Extensions = 292
Driver Bug Workarounds:
OpenGLBitmapZbufferBug = 0
OpenGLWobbleTesselatorBug = 0
OpenGLLineSmoothingBug = 0
OpenGLClippedImageBug = 1
OpenGLEraseModeBug = 0
configuration 2:
Win10 x64
Matlab 2015a
Rendered : opengl
'opengl info' result:
%
Version: '3.3.0'
Vendor: 'NVIDIA Corporation'
Renderer: 'GeForce 210/PCIe/SSE2'
MaxTextureSize: 8192
Visual: 'Visual 0x07, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buff...'
Software: 'false'
SupportsGraphicsSmoothing: 1
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 1
Extensions: {248x1 cell}
MaxFrameBufferSize: 8192
This link was usefull, but I am not sure I have all my solution there : http://fr.mathworks.com/help/matlab/ref/opengl.html#buwqhi1-8 Thank you for your help or idea to solve it !

Accepted Answer

Mike Garrity
Mike Garrity on 4 Jan 2016
Edited: Mike Garrity on 4 Jan 2016
No, that error message is talking about the data being passed into contour. It's not dependent on the graphics card or the renderer or anything like that.
Is it possible that you're running two different versions of MATLAB? I recall that this error message was added a couple of releases ago. If you've got one version from before the error was added and one version from after the error was added, then you would get this behavior.
Anyways, what that error message is trying to say is that you've got X and/or Y data that doubles back on itself. The result of contouring this type of data can be extremely confusing. We found users were often in this case by mistake and couldn't understand what was happening. When a user hit this case by mistake, they often didn't know that the resulting contour wasn't really showing what they thought it was. We added this error message so that they knew something funny was going on.
If you really intend to contour data which overlaps itself, then it is still possible to get contour to do it. We only added that error message for the case where XData and YData are vectors. If they're 2D arrays, then you can go ahead and have any sort of overlapping you'd like. The idea being that if you're actually passing all of the coordinates in, then you're probably more aware of the shape of your grid.
Let's look at a concrete example. Here's some data where the X is not monotone.
x = [1 2 3 2.75 2.25 2.5 3.25 4 5 6]
y = 1:10
z = sin((1:10)*pi/10 - pi)'*sin((1:10)*pi/10)
In earlier releases I could pass that straight into contour. Now I have to convert x and y to 2D arrays like this:
[x2,y2] = meshgrid(x,y);
contour(x2,y2,z)
Can you picture what this contour means?
Compare it to what you get if you pass the same data into surf.
As you can see, a contour plot may not be a very clear to visualize this sort of data. If you really do have data that is doubling back on itself, then you might want to investigate other approaches. If you don't think that your data should be doubling over on itself, then you should probably look at your grid data and make sure it's correct.
  2 Comments
Loic B
Loic B on 5 Jan 2016
This aswer could be usefull, but for the moment, we still continue to explore different possiblity to resolve the problem.
Loic B
Loic B on 6 Jan 2016
Edited: Loic B on 7 Jan 2016
Thank you! Now, it works well when I use "meshgrid" ! I didn't catch your example is here to test with meshgrid function...

Sign in to comment.

More Answers (1)

Loic B
Loic B on 5 Jan 2016
Edited: Loic B on 5 Jan 2016
Thank you for your long response. I confirm you that I use two different version of Matlab (as describe in "configuration 1" and "configuration 2" in my first post)
I tried your code and it work (display) without crash.
With Windows :
contourf (same result as you):
surfc (not really the same, because the contour appears on the bottom...):
But with Linux, colors aren't the same, but the graph is the same:
contours :
surfc:
But There is a difference about X value (= time) with my data set: (2 folowwing figure are generated with windows configuration) with data set 1 (continue time ):
With data set 2 (non linear axis), but still good size between x axis and y and z axis... (in the case, contours or surf crashes !!!)
Do you think this could be the origin of the problem ?
  2 Comments
Mike Garrity
Mike Garrity on 5 Jan 2016
I can tell that your Linux version is running an older version because the default colormap changed from jet (which you're seeing in your Linux pictures) to parula (which you're seeing in your Windows pictures) in R2014b.
So that means that means that on your Windows system you are going to be getting that error message if your X or Y data is non-monotone. As I said, you can avoid this error message by simply using meshgrid to turn your X & Y data into 2D arrays. That sort of tells contour "Don't bug me, I know what I'm doing". This will work fine in both versions.
From your plot of dataset 2, it looks like your data might have repeated values. This is an interesting edge case in the monotone test. We often distinguish between "monotone" (repeated values allowed) and "strictly monotone" (repeated values not allowed). The check here is for "strictly monotone". That seemed like the correct check because repeated X or Y values do generate discontinuities in the contour that can be very confusing.
I'm a big concerned about the bit in parenthesis after your description of dataset 2.
(in the case, contours or surf crashes !!!)
Could you expand on this? What do you mean by "surf crashes". You're not referring to that same error message about the non-monotone data, because surf doesn't
Loic B
Loic B on 7 Jan 2016
with this sentence :
(in the case, contours or surf crashes !!!)
I wanted to tell you that contours and surf graphics couldn't be succefully, due to my error in the code...
Thank you! Now, it works well when I use "meshgrid" ! I didn't catch your example is here to test with meshgrid function...

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!