Hot answers tagged

25

This is a simple little hack that will replace the polygons created by your Filling command with a set of random points. By default I'm scaling the number of random points by the number of points in the polygon, so that the density of points stays relatively constant. dotFillPlot[plot_, ndots_: 5] := plot // Normal // ReplaceAll[ Polygon[a__] :> ...


23

Update 2: Finally ... in version 12.1 you can use the new directives HatchFilling and PatternFilling: Graphics[{EdgeForm[{Thick, Black}], #, blob}, ImageSize -> 300] & /@ {HatchFilling[], Directive[Red, HatchFilling[Pi/2, 2, 10]]} // Row Graphics[{EdgeForm[{Thick, Black}], PatternFilling[#, ImageScaled[1/20]], blob}, ImageSize -> 300] &...


22

I was sure Histogram can be modified to have the hatching style. Little late but what about this! g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{yval, line}, yval = Range[ymin, ymax, 15]; line = Line /@ Transpose@{Most@({xmin, #} & /@ yval),Rest@({xmax, #} & /@ yval)}; {FaceForm[White],Polygon[{{xmin, ymin}, {xmax, ymin}, {xmax, ymax}, {...


18

Plot[{0.8333*H + 16.928*H^0.25 - 85, Max[-9 + Max[H - 80, 0], H - 80]}, {H, 0, 700}, PlotStyle -> {Directive[Black, Thick], Black}, Filling -> {1 -> {{2}, {Yellow, Transparent}}}]


17

You can post-process ParametricPlot output to change Line to FilledCurve: ParametricPlot[{(1 - Cos[2 π s]) Sin[2 π s], Cos[2 π s] (Sin[2 π s] + 1)}, {s, 0, 1}, Axes -> False, PlotStyle -> Black] /. l_Line :> FilledCurve[l] Use the replacement rule l_Line :> {Opacity[1.], FilledCurve[l]} to get We get the same result if we use a rule ...


16

I would do something like: t = RandomVariate[NormalDistribution[0, 1], 10000]; a = Histogram[t, 30, ChartStyle -> White]; b = Histogram[t, 30, ChartElements -> Graphics[{Black, Line[{{0, 0}, {1, 1}}]}]]; Show[a, b]


16

I have distilled a minimal dataset reproducing the problem: data = {{{45.904`, 227.46`}, {46.012`, 222.72`}, {46.076`, 215.51`}, {46.107`, 206.26`}, {46.119`, 196.15`}, {46.119`, 186.97`}, {46.118`, 178.5`}, {46.104`, 168.16`}, {46.079`, 156.43`}}, {{45.912`, 212.72`}, {45.976`, 205.51`}, {46.007`, 196.26`}, {46.019`, 186.15`}, {46.019`, ...


14

Here is extended version of PlatoManiac's solution which allows changing of the direction of the hatching and also tuning the distance between hatches: g[step_?NumberQ][{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{yval, lines, xstart, xend}, yval = Range[ymin, ymax, Abs[step]]; If[step > 0, {xstart, xend} = {xmin, xmax}, {xstart, xend} = {...


13

Alternatively, you can use the +/- option of Filling Plot[{x + 7, 9 - x^2}, {x, 0, 1.5}, Filling -> {1 -> {{2}, {LightBlue, White}}}]


13

im = Binarize@Import["http://i.stack.imgur.com/ZDeYq.jpg"]; Colorize[MorphologicalComponents@im, ColorRules -> {1 -> Red, 2 -> Yellow, 3 -> Blue, 4 -> Green}]


13

Changing the order of lists restore the filling x = {{10.5, 8.5}, {20, 15.3, 11.9, 8.8}, {16.5, 12.5, 9.2, 6.5}}; ListLogPlot[x, Joined -> True, PlotRange -> {{1, 5}, All}, Filling -> {1 -> {{3}, Brown}, 2 -> {{3}, Gray}}]


13

It can be done in several ways, but, I am afraid, none of them with ease similar to setting the colors with an RGBColor command:) 1. Using Show and ParametricPlot with different Mesh* settings Create four different ParametricPlot each with different settings for the Mesh* options and use Show to put them together: ClearAll[meshedParametricPlot] ...


13

f1h = HoldForm[10 - Sqrt[10^2 - x^2]]; f1 = f1h // ReleaseHold; f2h = HoldForm[5 - Sqrt[5^2 - (x - 5)^2]]; f2 = f2h // ReleaseHold; f3h = HoldForm[5 + Sqrt[5^2 - (x - 5)^2]]; f3 = f3h // ReleaseHold; The x values for the curve intersections are {x1, x2} = x /. Solve[f1 == #, x][[1]] & /@ {f2, f3}; The point coordinates for the curve intersections ...


12

You can use the PDF of a HistogramDistribution for the outline. dist = HistogramDistribution[T, 30] p1 = Plot[PDF[dist, t], {t, -4, 4}, PlotStyle -> Black, Exclusions -> None, PlotPoints -> 100]; p2 = Histogram[T, 30, "PDF", ChartElements -> Graphics[{Black, Line[{{0, 0}, {1, 1}}]}]]; Show[p1, p2] The problem here is that it isn't a ...


12

Graphics[{ Yellow, FilledCurve[{BSplineCurve /@ {pts1, pts4, Reverse@pts2, pts3}}], Green, Line[Join[pts1, pts4, Reverse@pts2, pts3]], Red, Point[Join[pts1, pts2, pts3, pts4]] }]


12

Update 2: In version 12.1 you can use the directives PatternFilling or HatchFilling for MeshShading: ParametricPlot[ Evaluate[v f[x] + (1 - v) shiftF[f][x, .2, ar prr]], {x, 0, 1}, {v, 0, 1}, MeshFunctions -> { #4 &}, MeshShading -> {None, HatchFilling[]}, Mesh -> { {{1,Directive[Thick, Opacity[1],Red]},{0, White}}}, AspectRatio ->...


12

Here's an adaptation of m_goldberg's answer that uses a single plot for his example: Plot[ { c2[x], ConditionalExpression[c1[x], x<.7], ConditionalExpression[c1[x], x>.7] }, {x, 0,1}, PlotStyle->{Red, Blue, Blue}, Filling->{2->{Axis, LightBlue}, 1->{{3}, LightBlue}} ]


11

Perhaps a "quick" appoach (in addition to looking at hyperlink of @rm-rf): msp[f_, {xmin_, xmax_}, {ymin_, ymax_}, mfun_, mnum_, swatchsize_, opts : OptionsPattern[]] := Module[{pm, swl}, pm = RegionPlot[x < 1, {x, 0, 1}, {y, 0, 1}, MeshFunctions -> mfun, Mesh -> IntegerPart@(mnum/(swatchsize/10)), Frame -> False, PlotRange -> {...


11

This is what I've ended up doing. data1 = exPDMIABSA[[1]]; data2 = exPDMIAwater[[1]]; Show[ListLinePlot[{data1, data2}, PlotStyle -> {Directive[Dashed, Black], Black}, Filling -> {2 -> Axis}, FillingStyle -> Gray], RegionPlot[ y < Interpolation[data1, InterpolationOrder -> 1][x] && y > 0, {x, 300, 375}, {y, 0, ...


11

Since the filling in the original DateListPlot is a Polygon, you can post-process it to add a texture. The tricky bit is getting the scaling correct - I rescale the polygon coordinates relative to the PlotRange (so the texture coordinates run from 0 to 1 across the width and height of the plot) and crop the image to the correct aspect ratio: imagefill[plot_,...


11

MeshFunctions are useful here. Plot[{Sin[x]^2, Sin[10 x]^2}, {x, 0, 5}, PlotStyle -> {Red, Blue}, Mesh -> {{0}}, MeshFunctions -> {Sin[#]^2 - Sin[10 #]^2 &}, MeshStyle -> Green]


10

Reverse points around y=x axis (flip y-x coordintaes) to get correct filling But now you plot is flipped - so flip again around y=x with GeometricTransformation Here it is: pl = ListLinePlot[(Reverse /@ data[[All, {#, 3}]]) & /@ {1, 2}, Filling -> {1 -> {2}}]; Graphics[GeometricTransformation[pl[[1, 2]], ReflectionTransform[{-1, 1}]], Frame ->...


10

I made an answer by J.M. and Murta into a function: IntegralPlot[f_, {x_, L_, U_}, {l_, u_}, opts : OptionsPattern[]] := Module[{col = ColorData[1, 1]}, Plot[{ConditionalExpression[f, x > l && x < u], f}, {x, L, U}, Prolog -> {{col, Line[{{l, 0}, {l, f /. {x -> l}}}]}, {col, Line[{{u, 0}, {u, f /. {x -> u}}}]}}, ...


10

This is my second answer, which is a rather different (and simpler) idea than my first one, namely, add a polygon that shades from a Line in the plot to a vertical axis at x = x0. fillVertical[plot_, x0_: 0.] := plot /. Line[p_] :> {{Opacity[0.2], Polygon[p ~Join~ {{N @ x0, p[[-1, 2]]}, {N @ x0, p[[1, 2]]}}]}, Line[p]} The shading automatically ...


10

Note that your list spec in the Filling suggestion is the other way around. You mean Filling->{1->{2}} With this style you can incorporate the filling style directly there and therefore, what you want can be written down as ranges = {.01, .05, .25, .5, .75, .95, .99}; col =col = RGBColor[.6, .6, 1]; Manipulate[ Plot[Evaluate@ Quantile[ ...


10

One Plot can do too: Plot[{If[x < 1, 1/(x^2)], If[x > 1, 1/(x^2)]}, {x, 0, 4} , AspectRatio -> 1 , Filling -> {2 -> {Axis, Red}} , Epilog -> {Purple, Rectangle[]} ]


10

It seems this form still works: ListPlot[ Table[{x, x^2}, {x, 0, 1, 0.1}], PlotRange -> All, Filling -> {1 -> {Axis, Arrow[#] &}} ] Caveat The use of a Function as a filling style seemed undocumented, therefore one cannot expect the feature to remain or remain unchanged in new versions of Mathematica. ybeltukov notes in a comment that ...


10

p[x_, left_, right_] := If[left < x < right, 1, Undefined] Plot[{Emin p[wk, 0, 4], Emax1 p[wk, 0, 2], Emax2 p[wk, 2, 4]}, {wk, 0, 4}, Filling -> {1 -> {{2}, Pink}, 1 -> {{3}, Pink}}] Edit You may also use for example the more idiomatic p[x_, left_, right_] := 1 /; left < x < right for the same purpose. What you need is a ...


10

In versions from 8 to 10.3 the option Mesh->Full gets rid of the unwanted markers: ListLinePlot[{{12., 13., 6., 16., 15., 12., 7., 15., 15., 17.}, {9., 9., 9., 9., 9., 9., 9., 9., 9., 9.}}, Filling -> {1 -> {2}}, Frame -> True, FrameTicks -> {{Automatic, None}, {Automatic, None}}, GridLines -> {Range@10, Automatic}, PlotMarkers -&...


10

f[s_] := Plot[{U1[del], U2[del], Dead[del], If[s[U2[del], #], #, U2[del]] &@Max[U1[del], Dead[del]]}, {del, 0, 1}, PlotRange -> {0, 1}, PlotStyle -> {{Blue, Dashed, Thick}, {Red, Dashed, Thick}, {Green, Dashed, Thick}, ...


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