Rasterizing a plot make axes ticks invisible

There is a hack that has some added advantages - in particular as a by-product you also get a vector graphics version of your plot that can be resized while keeping all relative sizes at the correct proportions:

plot = Plot[x, {x, 0, 10}];
h = First@ImportString[ExportString[plot, "PDF"]];

Rasterize[h, ImageResolution -> 300]

raster

The result has all the ticks at the same relative size as in the notebook. Moreover, the intermediate graphic in h contains the plot as if it had been exported to PDF and re-imported, i.e., it's a vector graphic but structured in a way that doesn't allow Mathematica to revise its tick marks etc.


You can try to regulate ImageSize together with ImageResolution. There is one example: You get:

plot = Plot[x, {x, 0, 10}, ImageSize -> 250];
g = Rasterize[plot, ImageResolution -> #] & /@ {25, 50, 100, 200};
ImageDimensions /@ g
TableForm[Partition[g, 2]]

enter image description here

And yes, the quality is not as good as the vectorial form. Where we get: enter image description here

I think that it's due different way Mathematica render vector and images.