PDA

View Full Version : Rasterized density plot + countour plot in Mathematica (to solve EPS issues)


abonatto
Jun3-11, 10:16 PM
Dear All,

I am plotting a density and a contour plot of the same function in order to have a smooth shading in the background of the contour lines. I do this using "Show[DensityPlot[...], ContourPlot[..., ContourShading->None]", like the following example given by Mathematica help files:

Show[DensityPlot[Sin[x] Sin[y], {x, -3, 3}, {y, -3, 3}],
ContourPlot[Sin[x] Sin[y], {x, -3, 3}, {y, -3, 3},
ContourShading -> None]]

The problem is that, when I do this procedure to plot large lists of imported data, there are 2 big issues:

1st) there are some artifacts in the shading (like irregular grids of white lines).

2nd) if I export this as an EPS, the size of the generated file is huge!

As a solution I was thinking of rasterize the density plot (without frame, to have just the color gradient as a bitmap) and show it together with the contour plot (this way, all the contour lines and frame fonts would preserve their vectorial format). I have tried the following command:

Show[Rasterize[DensityPlot[...]], ContourPlot[..., ContourShading->None]

But it is not working. Any suggestions?

Regards.