3
$\begingroup$

I have ColorData[1] as the default color scheme for plots in Mathematica.
I would like to know what is the default color for the filling.

Please note: I understand the color is the same as the one for the line, with Opacity[0.2], but I do not want this. I want the "equivalent color" obtained by having a filling on white background.

Imagine for example you want to plot an object with Opacity[1], of the same color of the filling.

How could I do this?

$\endgroup$
1
  • 2
    $\begingroup$ I think this can be solved using Belnd[] $\endgroup$ Commented Dec 1, 2017 at 16:26

2 Answers 2

3
$\begingroup$

From the "Details" section of Opacity:

If an opacity a object with color $c_1$ is placed in front of an object with color $c_2$, the resulting color will be the blend a $c_1+(1-a)c_2$.

Like @m137 said, this can be achieved by using Blend. Alternatively, Lighter should do the trick as well:

g1 = Graphics[ {Opacity[0.2], ColorData[1, "ColorList"][[1]], Rectangle[]}, ImageSize -> {100, Automatic} ]; g2 = Graphics[ {Lighter[ColorData[1, "ColorList"][[1]], 0.8], Rectangle[]}, ImageSize -> {100, Automatic} ]; Rasterize[g1] === Rasterize[g2] (*True*) 
$\endgroup$
2
$\begingroup$

You can inspect the plot FullForm and see what is the Filling color:

Plot[Sin[x], {x, -2, 2}, Filling -> Bottom][[1, 1, 2, 1, 2, 2]] (* Directive[RGBColor[0.368417, 0.506779, 0.709798], Opacity[0.2]] *) 

In a more complex plot:

Plot[Evaluate[Table[Sin[x + Pi n/4], {n, 0, 7}]], {x, 0, 2 Pi}, Filling -> Axis, PlotStyle -> ColorData[3, "ColorList"]][[1, 1, 2, 1]] 

You will see all the Filling colors.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.