I am trying to in a way automate the shading issue described here: Drawing a box with shading in pgfplots

The general goal is to put a working code part in my style definition using append after command.

But actually I am trying to find out how to solve some general problems.



\draw[step=2ex,gray!20,thin] (-10ex,-7ex) grid (10ex, 7ex);

\node[draw, rectangle, rounded corners=6pt] at (0ex, 0ex) (md) {My Design};

(md.north west)  [rounded corners=6pt] -- (md.north east) 
-- (md.south east) --
(md.south west) -- cycle;

\pgfextractx{\nwx}{(cd.north west)}

% necessary to match up coordinate systems:
hide axis,
\addplot[surf,mesh/color input=explicit,shader=interp] 
table[meta=cdata] {
    x y cdata
    -6.5 2 color=gray!40
    -6.5 -2 color=gray!40

    5.5 2 color=white
    5.5 -2 color=white



Current Example

As in the code above the clipping-part was somewhat easy to solve.

Now I have to change the plot accordingly. For this I need the x and y values of the used coordinates in the clip-part to insert them automatically and not manual.

Trying to use the let command in \addplot didn't work. So I tried to extract the values with \pgfextractx. But this brought me to another problem: The result is given with the unit pt and produces an error. Additionally it would be nicer if I could use ex-values in the axis and don't have to change this to pt, because I think this could be an issue when I scale the graphics.

So is there a solution to convert the value to an ex unit and then remove the unit from the string?

Better solutions in general are also welcome! Thank you!

  • Does something like tex.stackexchange.com/a/426245/95441 help? – Stefan Pinnow Jun 28 '18 at 11:24
  • Why do you want to plot it particularly? I don't really understand that part. – cfr Jun 30 '18 at 22:22
  • Because it is not possible to have it in cmyk color otherwise. – baghira Jul 2 '18 at 4:18
  • @Stefan I will have a look at it, as soon as I find the time. – baghira Jul 2 '18 at 4:23
  • @baghira, any news here? – Stefan Pinnow Jul 4 '18 at 10:43