# ListDensityPlot generates a huge pdf output

I have been using ListContoutPlot to plot some data and then export it to a pdf file.

Seeing as the ListContourPlot has its own ideas regarding the placement of contours I've switched to ListDensityPlot, thus having the right contours (as I wanted).

But this resulted in a new issue for me, before the switch the outputted pdf file's size was ~5MB, now I'm getting file's size at around ~200MB. What options do I have if I want to maintain at least one high-quality output file (vector based image)?

I'm trying to keep an un-rasterized image file, but not at all cost.

EDIT
Minimal working example:

On Mathematica 10.0.1.0, the resulting pdf's file size are 74.2kB for the ListContourPlot and 22.6MB for the ListDensityPlot.

data=Table[{x,y,RandomInteger[{1,7}]},{x,Range[100]},{y,Range[100]}];
op={ColorFunctionScaling->True,ColorFunction->"DarkBands",InterpolationOrder->0};
con=ListContourPlot[data,Evaluate@op];
den=ListDensityPlot[data,Evaluate@op];
Export["./con.pdf",con,"PDF"]; (* 74.2kB *)
Export["./den.pdf",den,"PDF"]; (* 22.6MB *)

• Do you have a minimal working example (including data, real or not, and appropriate code to generate the .pdf or images in question) that demonstrates this issue for you that we can compare to? – eyorble Feb 11 '18 at 18:25
• Rasterize the output. – David G. Stork Feb 11 '18 at 19:40
• Have you seen Contours for ListContourPlot? – Edmund Feb 12 '18 at 1:34
• I'll try to get a mwe, not sure I can make something as detailed as what I'm currently plotting (current runtime is about 15min for the data and the plot). And I have tried Contours, ContourShading and pretty much any other option to specify contours... Only the density plot shows all of them. – Mor Roses Feb 12 '18 at 9:01
• I've added a mwe. – Mor Roses Feb 12 '18 at 11:02

Export["den.pdf", den, "PDF", ImageResolution -> 600, "AllowRasterization" -> True];