Mathematica Asked by CamPos on April 11, 2021
I have the following plot, where {vsoundAll, decAll, pdivAll} are already given in some array and are irrelevant here. I am trying to fill the region between the yellow and red light using the command, Filling -> {2->{3}} but it does not works. What am I missing here? Here is my snippet. Thank you in advance
ListLinePlot[{vsoundAll, decAll, pdivAll}, Frame -> True,
PlotRange -> {{0.01, 0.4}, {0, 2}},
PlotStyle -> {"DarkColor", "Saphire", Red},
Filling -> {1 -> Top, 3 -> Top, 2 -> {3}}]
compressed = "1:eJzV3VFoVmUYB/
CzTdtsrVxrLTPZVk5dM5eNESKyCwkRClMvRIYXy1RGmYRGSBci4oWIGIhIF+
I3diESXoiIFyKyi6joIqK6iIguJKKLiOgiIoJ2nlD6juf891/f/5V/N8L6Pn+u533Oec/
7nvd93v7XDmzb25Jl2cEFs3+8PHnw0N6DTf/+qTm756e22T+2TRyaPPDWxJuTXbM/TL46+
0fJZzP5Z6/f/ew/Ks/nny1hlFv5N/ta7JVbdFweqP/3bJVovwcZZQbExUm5ScdlIv/m+
032yjCduyvzb9bKW9pJuUHHZW3+zU/
8lYH8s8cY5SOQu07KGrqld4PcdVKu0y39MYiLkzKef/YCozTl31xQnrtOyjU6Lp+
CuDgpi/LPFjLKHpC7TspOuqU/A3FxUq7QLT2SVfcBTsrqjL1jDmbV/
bSTsoNu6X0gd52Uy3RLfw5y10kZolu6oz6Ctkpnxo5JvgBxcVKepePSnVWP7Z2Ui3Tufgn
i4qT0Z+wT/
GhW3Qc4KdN0XL4GcXFSpmjljay6D3BSLtBK3Ftr5S3tpJynlaX137RVeumr8RuQu07Kioz
tA/aD3HVSztIt/S2Ii5OyjG7p9vybq8pz10lpzdiR8HcgLk7K+
owdk2gUFF2N8jaduxoFXQEaJe7s1P1Fo6C7lEbppq9GjYJ6Eo0yQueuRkG9vUbZTeeuRkF
PZBpl4j4r6KlZowzTLa1R0MhGo/Rk7P1Fo6DRp0aJ2XNq/kWjoBkCjfI4HReNgmZxNMoO+
mrUKGimTaPErB/Vq2mUOWdD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eF304ez5Ft5bnrpPDbyYckm9LTK7F4
m+rVzoLcdVL4DfKDki3/6ZUNdEsXDvqxVXrpqzGyvOavxOZWaiR8BuSuk8IXMRiQlGVIr/
TRLR3b4irGJE7K0Yy9vzwD4uKk8GUZokevGNs7KXxZhn4QFyeln87dwjFttgpfaKIXxMVJ
iblm6o4ZG8/
RjLWJwpfOiNFLrbylnZSn6dzdlFX3AU4KXwxkKchdJ4UvBnIK5K6TcpKOyxIQFyeFL29SO
GTTVuHLm/SAuDgpm+jcPQly10nhC7Z0g7g4Kcsztg+IO1FFH+Ck8AVbYla6z1/
hC7Z0gpZ2Us7QuVs4UNhW4UvQPALi4qTwJWjiybhiJOykxCx/M6OgYvJOCl+
CBpVed1JW0LmLSq87KXxRHVR63Unhi+r01/97tgpfVOcYaGknhS+
qgwqVOyl8UR1UqNxJ4YvqHAUt7aTwRXVQWW8nJf+BG9u31We5rTJFxwUVwXZS+
KI6qAi2kzJNxwUVwXZS+KI6qGS0kxLPE1Q/
jUpGOyl8UR1UMtpJ4YvqoALLTgpfVAcVWHZS+KI6qByxk8IX1UHliJ0UvqhOS/2/
Z6vwRXVQ8V4nhS+qg4r3Oil8UR1U6tZJ4YvqoFK3TgpfVAcVhnVS+
KI6qDCsk8IX1UFlVJ0UvqgOKqPqpPBFdW7/TxS+
qA4qOuqk8EV1UIlOJ4UvqoNKdDopfFEdVNDSSeGL6qCClk4KX1QHFbR0UviiOqigpZPCF9
VB5R+dFL6oDir/6KTwRXXibW7FmMRJ4YvqoPKPTsrMHeVvgxXDlA==";
Uncompress to get the three lists:
{vsoundAll, decAll, pdivAll} = Uncompress[compressed];
Replicate the issue:
ListLinePlot[{vsoundAll, decAll, pdivAll},
Frame -> True, Joined -> True,
PlotRange -> {{0.01, .4}, {0, 2}},
PlotStyle -> {"DarkColor", "Spahire", Red},
Filling -> {1 -> Top, 3 -> Top, 2 -> {3}}]
Several ways to fix:
1. Combine the second and third lists as Join[decAll, Reverse@pdivAll]
and use it as the fourth input list and add 4 -> Bottom
to the Filling
option setting:
ListLinePlot[{vsoundAll, decAll, pdivAll, Join[decAll, Reverse@pdivAll]},
Frame -> True, Joined -> True,
PlotRange -> {{0.01, .4}, {0, 2}},
PlotStyle -> {"DarkColor", "Spahire", Red, LineOpacity -> 0},
Filling -> {1 -> Top, 3 -> Top, 4 -> {Bottom, LightGreen}}]
2. Construct a FilledCurve
or Polygon
using decAll
and Reverse @ pdivAll
:
ListLinePlot[{vsoundAll, decAll, pdivAll},
Frame -> True, Joined -> True,
PlotRange -> {{0.01, .4}, {0, 2}},
PlotStyle -> {"DarkColor", "Spahire", Red},
Filling -> {1 -> Top, 3 -> Top, 2 -> {3}},
Epilog -> {LightOrange, FilledCurve[Line /@ {decAll, Reverse@pdivAll}]}]
Using
Epilog -> {LightOrange, Polygon[Join[decAll, Reverse@pdivAll]]}
gives the same picture.
3. An alternative approach is to create BSplineFunction
s from decAll
and pdivAll
and plot them using ParametricPlot
:
Show[ListLinePlot[{vsoundAll, decAll, pdivAll}, Frame -> True,
PlotRange -> {{0.01, .4}, {0, 2}},
PlotStyle -> {"DarkColor", "Spahire", Red},
Filling -> {1 -> Top, 3 -> Top, 3 -> {2}}],
ParametricPlot[v BSplineFunction[decAll][t] +
(1 - v) BSplineFunction[pdivAll][t],
{t, 0, 1}, {v, 0, 1}, AspectRatio -> 1/GoldenRatio,
PlotStyle -> Green, BoundaryStyle -> None]]
Correct answer by kglr on April 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP