I have a number of graphics objects, separately produced. I would like to combine them into one graphic, but color each one differently, so as to distinguish one from another. Something like
Show[ Style[graph1,Red], Style[graph2,Green] ]
but this doesn't work for me. Is there anyway to do this?
Thank you Dave Golber
The PlotStyle option gets hard-wired into the main Graphics data, and Show has no power on it. You may try with a replacement rule like
gr = ListPlot[{1, 2, 3}] gr[[1]] // InputForm gr /. RGBColor[___] -> Red
Thank you very much. This works ... basically.
Use // to see what the graphics object really is. In my case, it's got Hue in it. So
Starting with graphics object gr, to set the color to Red, do
grRed = gr/.Hue[ _ , _ , _ ]->H[0,1,1]
Documentation on Show says "Options explicitly specified in Show override those included in the graphics expression" so I hoped that something like
Show[{p1,p2}, PlotStyle->{Red,Green}]
would work. But it doesn't. I think it would be very useful to be able to combine previously generated graphics in a single plot as you want. Particularly since we would be able to do the basic work without worrying about setting things up for later display. But I don't know how to do this -- maybe others will comment?
Thanks for trying to help, but this isn't my situation. Let me be more explicit:
gr1=ListPlot@elaborate calculation .... which take several minutes and I don't want to run it again
gr2=ListPlot@ another elaborate calculation .... which take several minutes and I don't want to run it again
When I made gr1 and gr2, I did't plan on showing them together, so I didn't do anything special about the colors. Now I want to put them together, and have gr1 in one color and gr2 in another color. Sop I want to do something like
Graphics[{{Red, Disk[{0, 0}, 1]}, {Green, Disk[{1, 1}, 1]}}]
I should also mention that the grouping I used above is not necessary. I often produce that in building the graphic list, but it is only the order that matters.
Graphics[{Blue, Disk[{-1, -1}, 1], Disk[{0, 0}, .5], Yellow, Disk[{1, 1}, 1]}]