MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Coloured lines in graphics but black in print

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36601] Re: [mg36524] Coloured lines in graphics but black in print
  • From: Omega Consulting <omega_consulting at yahoo.com>
  • Date: Fri, 13 Sep 2002 01:14:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 02:27 AM 9/11/2002, Mike wrote:
>Is it possible to configure a style sheet so that functions or data shown in
>graphs are coloured (colored :)) in working but black in printing...without
>actually re-executing the function that created the graphics?
>
>thanks
>
>Mike

There is no way do this, but with a couple of tricks you can create the 
same effect.

First, we generate 2 graphics. One is the normal graphic. The other uses 
all black colors. This process is automated by changing $DisplayFunction.

$DisplayFunction =
     (   (* first the normal graphic *)
         Display[$Display, #1];
         (* then a new B&W graphic *)
         CellPrint[
           Cell[GraphicsData["PostScript",
               DisplayString[#1 /. {_RGBColor | _CMYKColor ->
                       GrayLevel[0]}]], "GraphicsPrintout"]];
         #1
         ) &;

If you set this and do a plot you will see the two graphics. The second 
graphic will look strange because it's in a different cell style. We're 
going to use the cell styles to control which graphic is shown.

Next, open the style sheet (menu item Format>Edit Style Sheet). Replace the 
Graphics/Printout style with the following cell.

Cell[StyleData["Graphics", "Printout"],
   ShowCellBracket->False,
   CellMargins->{{0, 0}, {0, 0}},
   CellElementSpacings->{"CellMinHeight"->0},
   CellGroupingRules->"NormalGrouping",
   CellFrameMargins->False,
   CellSize->{Inherited, 0},
   Background->None]

It hides the colored cell in the Printout environment. Then, add the 
following styles.

Cell[StyleData["GraphicsPrintout"],
   CellMargins->{{4, Inherited}, {Inherited, Inherited}},
   CellGroupingRules->"GraphicsGrouping",
   CellHorizontalScrolling->True,
   PageBreakWithin->False,
   GeneratedCell->True,
   CellAutoOverwrite->True,
   ShowCellLabel->False,
   DefaultFormatType->DefaultOutputFormatType,
   LanguageCategory->None,
   FormatType->InputForm,
   ImageMargins->{{43, Inherited}, {Inherited, 0}},
   StyleMenuListing->None,
   FontFamily->"Courier",
   FontSize->10]

Cell[StyleData["GraphicsPrintout", "Printout"],
   ImageMargins->{{30, Inherited}, {Inherited, 0}},
   Magnification->0.8]

Cell[StyleData["GraphicsPrintout", "Working"],
   ShowCellBracket->False,
   CellMargins->{{0, 0}, {0, 0}},
   CellElementSpacings->{"CellMinHeight"->0},
   CellGroupingRules->"NormalGrouping",
   CellFrameMargins->False,
   CellSize->{Inherited, 0},
   Background->None]

It hides the B&W cell in the Working environment and shows the cell in the 
Printout environment.

Finally, try it out.

Plot[x, {x, 0, 1}, PlotStyle -> RGBColor[1, 0, 0],
     TextStyle -> {FontColor -> RGBColor[0, 0, 1]}]

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"

Spend less time searching and more time finding.
http://www.wz.com/internet/Mathematica.html



  • Prev by Date: RE: creating adjacency matrices
  • Next by Date: Re: Empirical CDF and InterpolatingFunction
  • Previous by thread: RE: Coloured lines in graphics but black in print
  • Next by thread: Jlink/ReadList