1
$\begingroup$

Hi I'm trying to put together a graphing template. Unfortunately, my arrowheads are a different colour than my functions when the graph is exported to something like a PDF. Is there a way I can manually set the arrowhead colours in CMYK using this setup? I'd also like to change the function arrowheads to lines instead of enclosed arrows. Here's the important parts. The arrowheads come from 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]]}
    }]],

 Plot[f, {x, min - 0.58*gridx, max + 0.58*gridx},

   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]}}
      ]
  /. Line[x__] :> Sequence[Arrowheads[{-.02, .02}], Arrow[x]]
 ]
$\endgroup$

1 Answer 1

1
$\begingroup$

This appears to change the arrow heads to your preferred style:

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]]}}]],
 Plot[f, {x, min - 0.58*gridx, max + 0.58*gridx},
   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]}}] /. Line[x__] :>
   Sequence[
    Arrowheads[
     {
      {-.02, 0, Graphics[Line[{{{-1, 1/2}, {0, 0}, {-1, -1/2}}}]]},
      {.02, 1, Graphics[Line[{{{-1, 1/2}, {0, 0}, {-1, -1/2}}}]]}
      }
     ],
    Arrow[x]]]

output

I don't know about the CMYK colors for the arrow heads - I don't see why they should be different from the lines...

$\endgroup$
2
  • $\begingroup$ Thanks. At least half the problem is solved. $\endgroup$ Jun 30, 2013 at 3:39
  • $\begingroup$ @keystonethewizard You can insert CMYKColor calls into the Graphics[] expression that draws the arrow-heads... $\endgroup$
    – cormullion
    Jun 30, 2013 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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