I need to "monochromize" a large amount of plots (mostly coming from ListPlot) and export them to PDF. The problem is that I no longer have the data used to generate the plots, I only have notebooks that contain the plots. I attempted copy-pasting one plot and then something along the lines of Show[plot,PlotTheme->"Monochrome"] but that obviously did not work. I also tried ColorConvert[plot,"Grayscale"] but then the exported PDF was of extremely poor quality although I used the ImageResolution option of Export. One could, I think, extract the points from FullForm of the plots and simply plot them once more but this seems to be quite complicated given the quantity of the plots I have and their various structure (some of the ListPlot outputs contain two lists, some of them three, I also have a couple of simple graphics coming from Plot). Method of last resort is using some other software like Photoshop, but that makes the PDF many times larger - I need to use the plots with LaTeX so this would be the last option.


Example plot:

Plot[{Cos[x], Sin[x], Tan[x]}, {x, 0, 2 π}]

Mathematica graphics

Now, just copy this plot from the notebook (using ctrl-C) and paste it in the front of following expression:

/. a : RGBColor[__] :> ColorConvert[a, "Grayscale"]

Mathematica graphics

The result:

Mathematica graphics

  • $\begingroup$ This works perfectly, thank you. $\endgroup$ – Skumin Feb 9 '16 at 22:19

In the same spirit of Sjoerd's answer, you can "steal" the theme-generated directives and replace them in the target plot.

With a dummy plot created using the desired theme,

dummyPlot = Plot[{1, 2, 3}, {x, 0, 1}, PlotTheme -> "Monochrome"]

Dummy Plot

You can collect the generated directives,

directives = Cases[dummyPlot, Directive[a__] :> List@a, Infinity]


And apply them to the target plot (cycling through the list)!

plot = Plot[{Cos[x], Sin[x], Tan[x]}, {x, 0, 2 π}];
plot /. Directive[a__] :> (directives = RotateLeft[directives]; Directive[Last@directives])

Re-colored Plot

You must make a dummy plot with an equivalent number of plotted functions, otherwise you'll have to drop/add elements to the directives list.


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