0
$\begingroup$

I am trying to plot the region in between two curves that I only have as discrete data, without plotting the curves corresponding to the data.

In principle, I could interpolate the functions and then do a RegionPlot with the interpolated functions, but this seems complicated. The following simple code snippet gets very close to doing the job, so I was wondering if there a simple modification that would get me there.

ListLinePlot[Transpose[Table[{Sin[x], Cos[x]}, {x, 0, 5, .1}]], 
Filling -> {1 -> {2}}, PlotStyle -> Thickness[0]]

Result: enter image description here

$\endgroup$
  • $\begingroup$ Either option would work. Or make them disappear entirely $\endgroup$ – Daniel Jun 26 at 11:34
1
$\begingroup$

One simple way this can be achieved is by the following options:

PlotStyle -> None, FillingStyle -> LightBlue

The first option turns off the lines, the second allows one to specify the filling colour.

Result: enter image description here

$\endgroup$
1
$\begingroup$

Try this:

RegionPlot[
 Or[y <= Cos[x] && y >= Sin[x] && Cos[x] >= Sin[x], 
  y >= Cos[x] && y <= Sin[x] && Cos[x] <= Sin[x]], {x, 0, 5}, {y, -1, 
  1}, AspectRatio -> 2/5]

yielding

enter image description here

Have fun!

$\endgroup$
  • $\begingroup$ Thank you! I was going for a way that doesn't highlight the curves (in your version they are a deeper shade of blue), as in my own answer. Furthermore, as I said, the function exists only as discrete data. $\endgroup$ – Daniel Jul 27 at 6:53
  • $\begingroup$ Its absolute OK when you give preference to any of the answers. However, I would like to inform you that the "highlighting" of the curves or "shade" of any color is only the question of options that you use, not of the method. Further, if you want to get a good answer to your question, put exact, unequivocal questions. $\endgroup$ – Alexei Boulbitch Jul 29 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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