1
$\begingroup$
ListLogPlot[{{95.90081`, 0.5562`}, {96.28275`, 0.66891`}, {96.10102`, 
   0.74037`}, {96.66512`, 0.81191`}, {96.48471`, 
   0.92386`}, {96.67568`, 1.01315`}, {96.86841`, 1.15284`}, {96.6858`,
    1.25267`}, {96.69768`, 1.60703`}, {95.95647`, 
   1.78698`}, {96.14612`, 1.90618`}, {95.40249`, 
   2.01475`}, {96.71132`, 2.13915`}, {98.58359`, 
   2.45645`}, {100.45674`, 2.87336`}, {101.5823`, 
   3.26938`}, {102.33692`, 3.89568`}, {102.7171`, 
   4.51531`}, {102.53757`, 5.23364`}, {101.98183`, 
   5.68693`}, {102.54945`, 6.71417`}, {102.36817`, 
   7.50032`}, {102.74526`, 8.14959`}, {102.74966`, 
   8.93728`}, {102.56617`, 9.53363`}, {103.31464`, 
   9.98339`}, {103.50869`, 11.67867`}, {103.51749`, 
   14.04538`}, {103.52453`, 16.27966`}, {103.53333`, 
   19.57876`}, {103.72737`, 22.90342`}, {103.7331`, 
   25.82209`}, {103.55181`, 28.84556`}, {103.55665`, 
   31.92684`}, {103.37558`, 35.83003`}, {103.57337`, 
   45.33377`}, {103.57997`, 52.06271`}, {103.58657`, 
   59.79044`}, {103.59405`, 69.94403`}}, Joined -> True, 
 PlotStyle -> Black, PlotRange -> {{80, 300}, {0.55, 55}}, Frame -> True, FrameStyle -> Directive[Black, 20]]
$\endgroup$
2
  • 2
    $\begingroup$ Interesting question. One would think that Mma would readily enable the use of Filling to the Left or Right y axis, but the documentation specifies, Filling as "... an option for ListPlot, Plot, Plot3D, and related functions that specifies what filling to add under points, curves, and surfaces." Filling has no provision to fill to the side. Unless doing so would have unintended consequences I don't recognize, this could make an excellent feature request. $\endgroup$
    – Jagra
    Mar 30 at 15:11
  • $\begingroup$ A not good answer (but kind of funny) // Rasterize // Binarize // MorphologicalComponents // Colorize, so put as a comment. $\endgroup$
    – wuyudi
    Mar 30 at 15:15
2
$\begingroup$

Try the following. Let lst be your list. Then try

Show[{
  ListLogPlot[Join[{{50, 0.1}, {95, 0.1}}, lst], Joined -> True, 
   PlotStyle -> Black, PlotRange -> {{80, 300}, {0.55, 55}}, 
   Frame -> True, FrameStyle -> Directive[Black, 20], Filling -> Top, 
   FillingStyle -> LightYellow],
  ListLogPlot[Join[lst, {{103.6, 55}, {300, 55}}], Joined -> True, 
   PlotStyle -> Black, PlotRange -> {{80, 300}, {0.55, 55}}, 
   Frame -> True, FrameStyle -> Directive[Black, 20], 
   Filling -> Bottom, FillingStyle -> LightRed]
  }]

with the following effect:

enter image description here

Have fun!

$\endgroup$
1
  • $\begingroup$ Thank you so much. $\endgroup$ Mar 31 at 10:24
2
$\begingroup$

1. You can

  1. Reverse the coordinates of your input list (lst),
  2. Use ListLogLinearPlot with bottom and top fillings,
  3. Flip the coordinates of graphics primitives using ReflectionTransform
  4. Show the result with options from your original plot.

llp = ListLogPlot[lst, Joined -> True, PlotStyle -> Black, 
  PlotRange -> {{80, 300}, {0.55, 55}}, Frame -> True, 
  FrameStyle -> Directive[Black, 20]]


lllp = ListLogLinearPlot[{#, #} &@Map[Reverse]@lst, Joined -> True, 
   PlotStyle -> {Black, None}, 
   PlotRange -> Reverse@{{80, 300}, {0.55, 55}}, Frame -> True, 
   FrameStyle -> Directive[Black, 20], 
   Filling -> {1 -> {Bottom, Yellow}, 2 -> {Top, Red}}];

Show[lllp /. prims : (_Line | _Polygon | _Point) :> 
   GeometricTransformation[prims, ReflectionTransform[{1, -1}]], 
 llp[[2]]]

enter image description here

2. Alternatively, define a function for post-processing ListLogPlot output to add desired filling polygons:

ClearAll[addHorizontalFilling]
addHorizontalFilling[filling : {{_, _} ..}][g_Graphics] := 
 ReplaceAll[g, l : Line[x_] :> {GeometricTransformation[
       First@ListLinePlot[Reverse /@ x, 
         Filling -> (# /. {Left -> Bottom, Right -> Top}), 
         FillingStyle -> #2, PlotRange -> Reverse[PlotRange[g]]], 
       ReflectionTransform[{1, -1}]] & @@@ filling, l}]


addHorizontalFilling[{{Left, Yellow}, {Right, Red}}] @ llp

enter image description here

3. Yet another method: Post-process llp to add two polygons constructed using the coordinates of line objects:

llp /. l : Line[x_] :> 
 {{Red, 
   Polygon[Join[x, {Scaled[{1, 1}, First @ x], Scaled[{1, 0}, First @ x]}]], 
   Yellow, 
   Polygon[Join[x, {Scaled[{-1, 1}, First @ x], Scaled[{-1, 0}, First @ x]}]]}, 
   l}

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you so much. $\endgroup$ Mar 31 at 11:11

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.