0

I'm drawing graphs in Mathematica 9.0 and have converted all the colors to CMYK. Afterwards, I've added text and other information using the Drawing Tools palette. I'd like this stuff to be in CMYK color too, but can't find a way to change it. I'm using a demo version right now to see if this will work for our publications.

Thanks

[Later] Thanks, this helps. I'm making a 'dummy proof' template for our office to use but my function arrowheads seem to be a different colour than my functions when I export to something like a pdf. I'd like a way to manually control the colour of the arrowheads but can't seem to find one the way this is written. I also wouldn't mind changing the arrowhead style to just two lines instead of a solid shape. The arrowheads are the last line.

ClearAll["Global`*"];
Interpretation[{f = {  1/(x - 1) + 1, Sin[x], -x, x}, 
  points = {{3, 2}, {-5, -8}}, min = -10, max = 10, size = 0.5, 
  rmin = -10, rmax = 10, gridx = 1, gridy = 1, hlabel = "x", 
  vlabel = "y"}, 
 Panel[Grid[{{Style["Plot Characteristics", Bold], SpanFromLeft},
    {"Functions:", InputField[Dynamic[f]]},
    {"Points:", InputField[Dynamic[points]]},
    {"Domain Min:", InputField[Dynamic[min]]},
    {"Domain Max:", InputField[Dynamic[max]]},
    {"Range Min:", InputField[Dynamic[rmin]]},
    {"Range Max:", InputField[Dynamic[rmax]]},
    {"Grid Size (cm):", InputField[Dynamic[size]]},
    {"Gridline Space x:", InputField[Dynamic[gridx]]},
    {"Grdiline Space y:", InputField[Dynamic[gridy]]},
    {"Horizontal Label:", InputField[Dynamic[hlabel]]},
    {"Vertical Label:", InputField[Dynamic[vlabel]]}
    }]],
 Plot[f, {x, min - 0.58*gridx, max + 0.58*gridx},
   PlotRange -> {rmin - 1.01*gridy, rmax + 1.01 gridy} ,
   GridLines -> {Range[min, max, gridx], Range[rmin, rmax, gridy]},
   GridLinesStyle -> {{Dashed, CMYKColor[0, 0, 0, 1, 0.25], 
      AbsoluteThickness[0.5]}, {Dashed, CMYKColor[0, 0, 0, 1, 0.25], 
      AbsoluteThickness[0.5]}},
   Ticks -> {Range[min, max, gridx], Range[rmin, rmax, gridy]}, 
   TicksStyle -> 
   Directive[10, Opacity[0], FontOpacity -> 0.9999, 
     CMYKColor[0, 0, 0, 1], FontFamily -> "Helvetica"],
   ImageSize -> {(max + gridx - (min - gridx))*28.52*size + 37.2 + 
      6.4*StringLength[hlabel], (rmax + gridy - (rmin - gridy))*28.52*
       size + 49},
   AspectRatio -> Full,
   AxesLabel -> {Style[hlabel, Italic], Style[vlabel, Italic]},
   LabelStyle -> {{FontFamily -> "Helvetica", FontSize -> 14}},
   AxesStyle -> {CMYKColor[1, 1, 1, 1], AbsoluteThickness[0.5]},
   PlotStyle -> {{AbsoluteThickness[1], 
      CMYKColor[0, 0, 0, 1]}, {AbsoluteThickness[1], 
      CMYKColor[0, 0.83, 1, 0]}, {AbsoluteThickness[1], 
      CMYKColor[1, 0, 0, 0]}, {AbsoluteThickness[1], 
      CMYKColor[0.36, 1, 0, 0]}, {AbsoluteThickness[1], 
      CMYKColor[0.63, 0, 1, 0]}, {AbsoluteThickness[1], 
      CMYKColor[0, 0, 0, 1]}},
   Prolog -> {Arrowheads[{0.02, 0.01, {0, 0.03}}], 
     Arrow[{{max + gridx, 0}, {max + gridx + gridx/10, 0}}], 
     Arrow[{{min - gridx, 0}, {min - gridx - gridx/10, 0}}], 
     Arrow[{{0, rmax + gridy}, {0, rmax + gridy + gridy/10}}], 
     Arrow[{{0, rmin - gridy}, {0, rmin - gridy - gridy/10}}], 
     AbsolutePointSize[5], Point[points]},
   Epilog -> {Text[
      Style["Label", 12, FontColor -> CMYKColor[0, 0, 0, 1], 
       FontFamily -> "Helvetica"], {5, 5}]}
   ]
  /. Line[x__] :> Sequence[Arrowheads[{-.02, .02}], Arrow[x]]
 ]
  • This is quite a different question now... :) I recommend simplifying your problem down to the minimum possible code that demonstrates the issues, then asking on [http://mathematica.stackexchange.com](http://mathematica.stackexchange.com). If nothing else, you could answer some questions! :) – cormullion Jun 28 '13 at 19:20

2 Answers2

1

If it helps here is how you can get the RGB equivalents of your CMYK colors.

ColorConvert[ CMYKColor[0, 1, 1, 0] , "RGB"] /. RGBColor -> List

(*  {1., 0., 0.} *)

Or in a suitable range for the dialogs:

255 ( ColorConvert[ CMYKColor[.1, .8, .3, .15] , "RGB"] /. RGBColor -> List) // Round

(* {195, 43, 152} *)

I have a feeling you'll need to manually key them into the drawing tools dialog.

Of course you could always do your labeling using graphics primatives instead of the GUI tools, then you have full control.

Edit// just messed around with this. I can nicely match colors of drawing tools objects to CMYK primatives except fonts. Font colors can evidently be set via either the font dialog or the drawing tools dialog, but neither does anything that makes any sense to me. I think we can label the GUI drawing tools as not ready for high quality work.

agentp
  • 6,849
  • 2
  • 19
  • 37
1

I don't think I'd be keen on your approach - for one thing, if you generate the graph again, won't you have to re-do the annotations? Then, you're doing things by hand which you can probably automate more easily (if you've got a lot of this type of work to do...). Although it will take some time to learn to do everything via Mathematica.

This seems to preserve the CMYK colors when you export it:

p = Framed[
  Plot[
   Sin[x], 
   {x, 0, 2 Pi}, 
   PlotStyle -> CMYKColor[0, 1, 0, .15],
   PlotRangePadding -> 0,
   Prolog -> {CMYKColor[.1, .1, .3, .15],
     Rectangle[{-1, -1}, {2 Pi, 1}]},
   Epilog -> {Text[
      Style["Sine of x", 28,
       FontColor -> CMYKColor[.2, .5, 1, .15], 
       FontFamily -> "Optima Bold"],
      {4.5, .5}]}],
  Background -> CMYKColor[.3, .2, .0, .15],
  FrameStyle -> CMYKColor[.1, .2, .0, 0]
  ]

Export["p.eps", p]

plot

But it's been some time since I had to work with CMYK so I might not know what I'm doing anymore...:)

cormullion
  • 1,672
  • 1
  • 10
  • 24
  • Thanks, this helps. I'm making a 'dummy-proof' template for our office and I think I have all the colours figured out except my function arrowheads. When I export this to something like a PDF, they are a different colour than the functions. Here's what I have. I can't seem to change the colour of the arrowheads the way this is written. – user2520444 Jun 28 '13 at 14:27