Hot answers tagged

8

Perhaps you're looking for something like this: Plot[{ ConditionalExpression[x^2, x < 1], ConditionalExpression[x^2, x > 1], ConditionalExpression[2 + 2 x^2, x < 1] }, {x, 0, 2}, Filling -> {1 -> Bottom} ]


8

ListLinePlot[Transpose[data1], PlotStyle -> {Directive[Thick, Blue], Directive[Red], Directive[Red]}, Filling -> {2 -> {3}}, FillingStyle -> {Opacity[.25], Pink}, PlotTheme -> "Detailed"]


8

ListPlot[ {Thread[{x, y}], Thread[{x, y^2}], Thread[{x, y^3}], Thread[{x, y^4}]}, Filling -> { 1 -> {{2}, Opacity[0.3, Red]}, 3 -> {{4}, Opacity[0.3, Blue]} }, PlotStyle -> {Red, Red, Blue, Blue}, Joined -> True, PlotRange -> {1, 3} ]


7

Clear["`*"]; strength = {422.918, 488.943, 436.838, 420.08, 481.187, 430.53, 433.959, 414.308, 468.762, 470.08, 459.893, 428.151, 423.193, 421.472, 484.492, 463.508, 428.949, 497.333, 470.477, 402.887, 471.617, 433.492, 415.18, 420.383, 474.359, 447.246, 445.556, 480.03, 459.678, 448.732}; fig = ProbabilityScalePlot[strength, "...


7

Plot[{6*0.3 t^2, 3 t - 12*0.3 t^2, -3 t + 12*0.3 t^2, 3 t, ConditionalExpression[3 t, 8/9 <= t <= 5/3]}, {t, 0, 5/3}, PlotStyle -> {Automatic, Automatic, Automatic, Automatic, None}, PlotRange -> {0, Automatic}, GridLines -> {{8/9, 5/6, 5/3}, {0}}, GridLinesStyle -> {{Dashed, Blue}, {Dotted, Blue}}, Filling -> {2 -> Axis, 5 ...


6

Add a region. a = Plot[{V = 6*0.3 t^2, V = 3 t - 12*0.3 t^2, V = -3 t + 12*0.3 t^2, V = 3 t}, {t, 0, 5/3}, PlotRange -> {0, Automatic}, GridLines -> {{8/9, 5/6, 5/3}, {0}}, GridLinesStyle -> {{Dashed, Blue}, {Dotted, Blue}}, Filling -> {2 -> Axis}]; b = RegionPlot[-3 t + 12*0.3 t^2 <= V <= 3 t && t >= 8/9, {t, ...


6

The bug had been fixed. Here we attach the result. $Version (* 12.2.0 for Linux x86 (64-bit) (December 9, 2020) *) Row[triangle /@ {True, False}]


5

I think what you want is: Plot[{x^2, x}, {x, 1, 2}, PlotRange -> All, Filling -> {1 -> {2}}, PlotStyle->{Blue, Blue} ]


5

You need to interpolate between the two bounding curves. One way to do this is to multiply one of the bounding curves by $t$, multiply the other by $(1-t)$, and create a ParametricPlot running from $t = 0$ to 1. originalplot = ParametricPlot3D[ { {x*Sin[x], x*Cos[x], -(x/3)}, {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -(x/3)}, {Sqrt[y]*x*Sin[x], y^...


5

psp = ProbabilityScalePlot[strength, "Weibull", AspectRatio -> 1.25, PlotRange -> {{300, 600}, {0.5, 99.5}}, GridLines -> {Range[300, 600, 50], {0.1, 1, 10, 50, 63, 2, 90, 99}}, Epilog -> {Orange, halflines}]; prange = PlotRange[psp] + {{-1, 1}, {-1, 1}}; 1. Construct two ConicHullRegions from the two pairs of halflines ...


4

A few additional alternatives: ParametricPlot3D[{v x Sin[x], v x Cos[x], -2 x /3}, {x, 0, (11/4)*Pi}, {v, 1, 1.15}, PlotStyle -> Darker[Blue], Mesh -> None, PlotPoints -> 100] ParametricPlot3D[{v x Sin[x], v x Cos[x], -2 x /3}, {x, 0, (11/4)*Pi}, {v, 0, 1.15}, PlotStyle -> None, PlotPoints -> 100, MeshFunctions -> {#5 &},...


4

One easy way is to let ParametricPlot linearly interpolate between the two curves: f1 = {x*Sin[x], x*Cos[x], -((2*x)/3)}; f2 = {1.15*x*Sin[x], 1.15*x*Cos[x], -((2*x)/3)}; ParametricPlot3D[{ lambda f1 + (1 - lambda) f2 }, {x, 0, (11/4)*Pi}, {lambda, 0, 1}, PlotStyle -> Darker[Blue], Mesh -> None ]


4

If you have version 12.+, you can also use Around to process data1 and use ListLinePlot with the options IntervalMarkers and IntervalMarkersStyle: data1b = Around[#, {#3, #2} - #] & @@@ data1; ListLinePlot[data1b, IntervalMarkers -> "Bands", IntervalMarkersStyle -> Pink, PlotRangePadding -> {Automatic, {Automatic, Scaled[.1]}}]


4

Finally, with version 12.1 come the directives HatchFilling and PatternFilling which make the task much easier: Graphics[{HatchFilling["Diagonal"], EdgeForm[Black], Polygon[{{0, 0}, {1, 0}, {1, 1}, {0.5, 1.5}, {0, 1}}]}] img = ExampleData[{"TestImage", "Mandrill"}]; Graphics[{PatternFilling[img, ImageScaled[1.5]], EdgeForm[Black], Polygon[{{0, ...


4

Prolog is useful here. Plot[Sin[x], {x, 0, 2 π}, Prolog -> {LightBlue, Rectangle[{3 π/4, -2}, {5 π/4, 2}]}]


4

threshold = 1.; Plot[{x^2, x^2/6, ConditionalExpression[0, x <= threshold]}, {x, 0, 2}, PlotStyle -> {Automatic, Orange, None}, Filling -> {2 -> {{3}, {None, LightOrange}}}, PlotRange -> {0, 1}] and Plot[{x^2, x^2/6, Boole[x > threshold ]}, {x, 0, 2}, Exclusions -> {{threshold }}, PlotStyle -> {Automatic, Orange, None}, ...


4

The issue caused by differing vertical positions of Axis across plots with filling. plotswithfilling = Table[ Plot[PDF[NormalDistribution[i, 1], x] Exp[-Sqrt[i]/4] /. i -> Range[1, 3, 2] // Evaluate, {x, k, k + 1}, PlotRange -> Full, Filling -> Axis, Axes -> None, PlotStyle -> {ColorData[10][4 + k], Darker[ColorData[...


4

An alternative approach using a single ParametricPlot3D: ClearAll[f1, f2, f3, f4, f5] f1[x_, y_] := {x Sin[x], x Cos[x], -(x/3)} f2[x_, y_] := {Sqrt[y] x Sin[x], y^2 x Cos[x], -(x/3)} f3[x_, y_] := {Sqrt[y] x Sin[x], y^2 x Cos[x], -((x*y^2)/3)} f4[r_: {1, 1.15}][x_, y_] := Module[{t = Rescale[y, r]}, t f2[x, r[[2]]] + (1 - t) f3[x, r[[2]]]] f5[r_: {...


4

(1) Remove pairs with non-numeric elements from neg and pos, (2) Prepend (Append) neg (pos) with a point so that both series have the same horizontal and vertical ranges: newpoints = Transpose @ CoordinateBounds[Join @@ (Cases[{__Real}] /@ {neg, pos})]; negpos = MapThread[# @ #2 &] @ {{Prepend[First @ newpoints], Append[Last @ newpoints]}, Cases[{...


4

Reverse cheating: Show[{QuantilePlot[X, NormalDistribution[Mean[X], StandardDeviation[X]], ImageSize -> Automatic -> 200, LabelStyle -> 12, PlotStyle -> Red], Graphics[{Opacity[0.1], Gray, Rectangle[{-2, -2}, {2, 2}]}], ListLinePlot[{neg, pos}, Filling -> {1 -> -2, 2 -> 2}, FillingStyle -> White]}, PlotRange -> {{-...


4

You can also construct a TemporalData object from your x and y and use it with ListLinePlot: td = TemporalData[Table[y^i, {i, 4}], {x}]; llp = ListLinePlot[td, PlotStyle -> {Red, Red, RGBColor[.45, .77, .92], RGBColor[.45, .77, .92]}, Filling -> {1 -> {2}, 3 -> {4}}, PlotRange -> {1, All}] Alternatively, use Table[y^i, {i, 4}] as input ...


4

Plot[{g[x], f[x], -2, 2}, {x, -2, 2}, PlotStyle -> Black, Filling -> {1 -> {{3}, Opacity[0.5, Lighter @ Blue]}, 2 -> {{4}, Opacity[.5, Lighter @ Red]}}, Exclusions -> None, Frame -> True, Axes -> False, ImageSize -> Large, PlotLegends -> Placed[SwatchLegend[{Lighter @ Blue, Lighter @ Red}, Style[#, 16]&...


4

Clear["Global`*"] Show[ ListLinePlot[{{0, 1}, {1, 1}, {10, 10}}, PlotStyle -> Directive[Red, Dashed, Thickness[0.008]], Filling -> Top, FillingStyle -> Lighter[Gray, 0.85]], Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic], PlotRange -> {{0, 3}, Automatic}] EDIT: To obscure the lines by the Filling(adjust ...


4

Mathematica 12.1 has HatchFilling : Mpl = 1.22*10^(19) ContourPlot[ Log10[0.5 1/(100)^(1/8) Sqrt[ Mpl 10^x] (y)^(6/8) Exp[-(y)^3 1/8]], {x, -6, 16}, {y, 1, 10} , PlotLegends -> Automatic , FrameLabel -> {"x", "y"} , ClippingStyle -> {HatchFilling[]} , PlotRange -> {Automatic, Automatic, {-10, 10}}] It can be ...


3

Two work-arounds: 1. Use ListPlot without the filling option and post-process the output to add the filling polygons as Epilog: lp = ListPlot[{{344.41, 272.2, 280}, {345, 223, 278}}, InterpolationOrder -> 0, PlotRange -> {200, 400}, Joined -> True]; Show[lp, Epilog -> {Opacity[.5, LightBlue], Polygon @ Join[#, Reverse @ #2] & @@ ...


3

This is very closely related to this question. Here is a version of kglr's answer adapted to your problem: ListPlot[{ (*Horizontal line 1*){{0, 5}, {35, 5}}, (*Horizontal line 2*){{0, 10}, {35, 10}}, (*Vertical line 3*){{5, 0}, {5, 35}}, (*Vertical line 4*){{10, 0}, {10, 35}}, (*Horizontal line 5*){{0, 0}, {5, 0}} }, Joined -> True, Filling ...


3

You can use RegionPlot and the options MeshFunctions + Mesh + MeshStyle RegionPlot[Rectangle[], Mesh -> 50, MeshFunctions -> {#1 + #2 &, #1 - #2 &}, MeshStyle -> {Directive[Thin, Blue], Directive[Thin, Red]}, PlotStyle -> None, BoundaryStyle -> None, Frame -> False] Add the option MeshShading -> {{White, Cyan}, {Orange, ...


3

Plot[x^3, {x, -1, 1}, Filling -> {1 -> 0}, PlotStyle -> None, FillingStyle -> LightBlue]


3

This can be merged into a single Plot call which will make adding legend with Epilog easier. Here's an example f[x_] = 2/(1 - 2 x^2); g[x_] = -(2/(1 + 2 x^2)); Plot[ { g[x], f[x], -2, 2 }, {x, -2, 2}, PlotStyle -> Black, Filling -> { { 1 -> {{3}, Append[LightBlue, .5]}, 2 -> {{4}, Append[LightRed, .5]} } }, ...


3

Perhaps this is what you want Needs["ErrorBarPlots`"] // Quiet data = {{0, 1, 0.17}, {5, 1.4, 0.27}, {10, 1.95, 0.23}, {15, 2.05, 0.18}, {20, 2.55, 0.21}, {25, 3.01, 0.28}, {30, 3.76, 0.11}}; Show[ ErrorListPlot[data, PlotStyle -> {Hue[0.6, 1, 1]}, PlotMarkers -> {●, 15}, Frame -> True, FrameStyle -> Directive[Black, ...


Only top voted, non community-wiki answers of a minimum length are eligible