3
$\begingroup$

I have a Listplot like this:

data1 = {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.002049040366095212`, 0.006046761623219565`, 0.`, 0.0040569597143900364`, 0.`, 0.`, 0.`, 0.003932461533659998`, 0.`, 0.0009383675012055415`, 0.0039147455415398`, 0.0016435354273192113`, 0.0038090146680477125`, 0.001513840830449827`, 0.003641498216409037`};

ListPlot[{data1 + 0.1, data1 + 0.3, data1 + 0.4},PlotLayout -> "Stacked", Filling -> Automatic, Joined -> True, Frame -> True, PlotStyle -> {Blue, Yellow, Green},FrameStyle -> Black]

enter image description here

So far, I have not found a way to make the filling color exactly the same as the line color. How can I do that?? It appears to me that FillingStyledoes not work...

$\endgroup$
2
  • 2
    $\begingroup$ FillingStyle -> Opacity[1]? $\endgroup$
    – kglr
    Commented Apr 22, 2022 at 9:29
  • $\begingroup$ Oh that was easy! thx $\endgroup$
    – M.A.
    Commented Apr 22, 2022 at 9:32

2 Answers 2

7
$\begingroup$

Add

%/. Opacity[a_] :> Opacity[1]

enter image description here

$\endgroup$
1
$\begingroup$

If the plot color needs to be matched to the filling color, the opacity can be gleaned from the FullForm output for the plot and matched in PlotStyle.

data1 = {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
   0.`, 0.`, 0.`, 0.`, 0.002049040366095212`, 0.006046761623219565`, 
   0.`, 0.0040569597143900364`, 0.`, 0.`, 0.`, 0.003932461533659998`, 
   0.`, 0.0009383675012055415`, 0.0039147455415398`, 
   0.0016435354273192113`, 0.0038090146680477125`, 
   0.001513840830449827`, 0.003641498216409037`};

ListPlot[{data1 + 0.1, data1 + 0.3, data1 + 0.4}
 , PlotLayout -> "Stacked", Filling -> Automatic
 , Joined -> True
 , Frame -> True
 , PlotStyle -> {Opacity[0.2, Blue], Opacity[0.2, Yellow], 
   Opacity[0.2, Green]}
 , FrameStyle -> Black
 ]

enter image description here

$\endgroup$

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.