# Why does specifying a ColorFunction make figures non-vectorial?

If I save the figure generated by ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}}] as a PDF and open it in Affinity Designer (an alternative to Adobe Illustrator), the figure is vectorial and I can modify individual points, axes, etc. However, if I save the figure generated by ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}}, ColorFunction -> Function[{x}, Blend[{Red, Blue}, x]]], I get a rasterized image whose elements cannot be modified. Is there a way to get a vectorized image while specifying a ColorFunction?

• Which Mathematica version do you use? I don't reproduce this problem with versions 12.3.1 and 13.0.0 on Windows 10 x64. Jan 26 at 6:54
• working fine here too with MMA12.3.0 on Windows 10 x64. Jan 26 at 7:02
• The issue is the same as in this question, but applying Normal doesn't help here (it drops the coloring information, what I consider as a bug). Jan 26 at 7:23
• Thank you, I am using Mathematica 12.1.0.0 on Mac OS X 11.5 Jan 26 at 16:23

It can't be done easily with lines and polygons (because you'd have to construct gradients but subdividing the objects), but it could be done with points, as in your example. Are you only interested in ListPlot of points?

vcRules[vc_] := {
HoldPattern[Point[p_List, VertexColors -> Automatic]] :>
({RGBColor @@ vc[[#]], Point[#]} & /@ p),
HoldPattern[Point[p_List, VertexColors -> c_List]] :>
Riffle[c, Point[#] & /@ p]
};
ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}},
ColorFunction -> Function[{x}, Blend[{Red, Blue}, x]]] /.

GraphicsComplex[p_, g_, o1___, HoldPattern[VertexColors -> vc_], o2___] :>
GraphicsComplex[p, g /. vcRules[vc], o1, o2]

Export["/tmp/test.pdf", %];
Import[%, "PageGraphics"] Or this direct way:

ListPlot[

• Maybe I should add that it is the presence of VertexColors that triggers the rasterization, which happens when you specify a ColorFunction in *Plot* functions. Jan 26 at 5:30
• (+1) Actually, Normal should do the conversion. But currently, it simply drops the VertexColors what I consider as a bug. Jan 26 at 6:59