Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

During the debugging of my previous question (somewhat related), I encountered this strange behaviour: when the global option Antialiasing is set to True in Option Inspector, the following code gives non-antialiased plots (observe e.g. frames):

GraphicsRow@{
  ListContourPlot[
   Table[Sin[i + j^2], {i, 0, 2, 0.05}, {j, 1.2, 2, 0.05}], 
   ColorFunction -> ColorData["AvocadoColors"], Contours -> 10, 
   Mesh -> False, ImageSize -> 400],
  ListDensityPlot[
   Table[Sin[i + j^2], {i, 0, 2, 0.05}, {j, 1.2, 2, 0.05}], 
   ColorFunction -> ColorData["AvocadoColors"], Mesh -> False, 
   ImageSize -> 400]
  }

Mathematica graphics

The next input is from the same notebook, same session, the only difference is that GraphicsRow only contains one plot object. Result is antialiased (visible polygon edges are of no concern here, see other post).

GraphicsRow@{ListContourPlot[
   Table[Sin[i + j^2], {i, 0, 2, 0.05}, {j, 1.2, 2, 0.05}], 
   ColorFunction -> ColorData["AvocadoColors"], Contours -> 10, 
   Mesh -> False, ImageSize -> 400], ""}

Mathematica graphics

Question

Is it a bug of GraphicsRow?

share|improve this question
    
What platform are you using? –  ragfield Jan 20 '12 at 17:52
    
@ragfield FWIW I see the same behavior on mma7/win7. –  Mr.Wizard Jan 20 '12 at 18:22
    
I use Win7/Mma8. I should add that on the OSX/Mma8, while non-antialiasing is not that obvious due to some screen smoothing, still the two GraphicsRow objects produces different outputs. The first two plots seem to be non-antialiased, the second has the visible polygon edges. –  István Zachar Jan 20 '12 at 21:41

1 Answer 1

up vote 5 down vote accepted

GraphicsRow puts both plots into one GraphicsBox, which means they have to be rendered together. Since the DensityPlot contains VertexColors it has to be rendered (on some platforms) using the 3D graphics renderer, whose support for Antialiasing is highly hardware dependent.

ContourPlot output normally renders with a 2D graphics engine. DensityPlot normally renders with a 3D graphics engine. When you group the two together (via GraphicsRow in this case) it forces them both to render with the 3D graphics engine, and that causes the ContourPlot to have a slightly different appearance.

Take a look at this example, containing only the ContourPlot. This code forces the ContourPlot to be drawn with a 2D renderer (in my case Quartz, since I'm using a Mac) in one window and a 3D renderer (OpenGL) in another window. Observer the difference in appearance (at full size):

g = ListContourPlot[
   Table[Sin[i + j^2], {i, 0, 2, 0.05}, {j, 1.2, 2, 0.05}], 
   ColorFunction -> ColorData["AvocadoColors"], Contours -> 10, 
   Mesh -> False, ImageSize -> 400];

CreateDocument[g, CacheGraphics -> False, 
  "NotebookRenderingEngine" -> "Quartz"];

CreateDocument[g, CacheGraphics -> False, 
  "NotebookRenderingEngine" -> "OpenGL"];

enter image description here

share|improve this answer
1  
Could you please provide some detail of why the rendering is substantially different in GraphicsBox? –  Mr.Wizard Jan 20 '12 at 18:21
    
Just interested to know what the differences are - my eyes are struggling to see any difference between the images on my machine. –  cormullion Jan 20 '12 at 20:04
    
If you view the image at full size (right-click > Open in New Window) you can tell the one on the left (Quartz) is antialiased, while the one on the right (OpenGL) is not. Since it has been scaled down to fit in the webpage they both appear antialiased. –  ragfield Jan 20 '12 at 20:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.