1
$\begingroup$

This question already has an answer here:

I have this plot:

enter image description here

However, I would like the grid lines to be visible. I have tried to set the filling with some Opacity by means of FillingStyle. But when used, the filling loss the color, and turns standard blue with the assigned Opacity.

enter image description here

Is there any way to make my original filling semitransparent?

Oh, I would like a solution without making a background (like in this post), as posible.

As a minimal example:

 GraphicsRow[{Plot[Sin[x], {x, 0, 2 Pi}, 
  ColorFunction -> Function[{x, y}, Hue[y]], Filling -> Axis, 
  FillingStyle -> Automatic, GridLines -> Automatic], 
  Plot[Sin[x], {x, 0, 2 Pi}, ColorFunction -> Function[{x, y}, Hue[y]], Filling -> Axis, 
  FillingStyle -> Opacity[.5], GridLines -> Automatic]}]

enter image description here

$\endgroup$

marked as duplicate by Kuba Nov 28 '17 at 12:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Showing the code of what you have tried would be helpful. $\endgroup$ – Jack LaVigne Nov 28 '17 at 11:54
  • $\begingroup$ The plot is part of a long calculation with no relevance here. I think that the question is quite general to be used with any plot. $\endgroup$ – José Antonio Díaz Navas Nov 28 '17 at 11:56
  • 2
    $\begingroup$ btw, is the question about transparency of filling or seeing grid lines on top? Because for the latter there is Method -> {"GridLinesInFront" -> True} $\endgroup$ – Kuba Nov 28 '17 at 12:00
  • $\begingroup$ I have edited the question adding a minimal example. @Kuba I would like to see the grid lines on top. However, is not this equivalent to set an opacity to the filling? $\endgroup$ – José Antonio Díaz Navas Nov 28 '17 at 12:03
  • 1
    $\begingroup$ @JoséAntonioDíazNavas no it is not, changing opacity is only one way to do this. Other is to plot grid lines on top of plot. So is Plot[Sin[x], {x, 0, 2 Pi}, ColorFunction -> Function[{x, y}, Hue[y]], Filling -> Axis, FillingStyle -> Automatic, GridLines -> Automatic, Method -> {"GridLinesInFront" -> True}] the answer? $\endgroup$ – Kuba Nov 28 '17 at 12:04
3
$\begingroup$
Plot[Sin[x], {x, 0, π}, ColorFunction -> Function[{x, y}, Hue[y]],
  Filling -> Axis, GridLines -> Automatic]

Mathematica graphics

Plot[Sin[x], {x, 0, π}, 
 ColorFunction -> Function[{x, y}, {Opacity[0.5], Hue[y]}], 
 Filling -> Axis, GridLines -> Automatic]

Mathematica graphics

$\endgroup$

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