Prev: mixed ByteOrdering
Next: More Efficient Method
From: fd on 19 Nov 2009 05:24 All I'm having problems with Filling in ListPlot. I have two curves and would like different colors as one curve goes above the other, here goes the code; aris = {10000, 5000, 1000, 500, 100, 50, 20}; y = 10000; elist = Flatten[ConstantArray[#, IntegerPart[y/#]] & /@ aris]; n = 1; ariList = Reverse[{N[y/n++], #} & /@ elist] ListLogLogPlot[{ariList, {{1, 1}, {100000, 100000}}}, PlotRange -> All, InterpolationOrder -> {0, 1}, Joined -> True, Filling -> {2 -> {{1}, {Yellow, Orange}}}] If I define a interpolation function myself it works, but it is a bit of a nuisance f[x_] = Interpolation[ariList, InterpolationOrder -> 0][x]; LogLogPlot[{f[x], x}, {x, 10, 10000}, Filling -> {2 -> {{1}, {Yellow, Orange}}}] Is there a way of making it work correctly with ListPlot ? Would this be a bug ? Best F.
From: Sjoerd C. de Vries on 20 Nov 2009 06:38 The Filling documentation uses the same trick (I guess that's where you took it from), so I assume this is the best way to do it. On Nov 19, 12:24 pm, fd <fdi...(a)gmail.com> wrote: > All > > I'm having problems with Filling in ListPlot. I have two curves and > would like different colors as one curve goes above the other, here > goes the code; > > aris = {10000, 5000, 1000, 500, 100, 50, 20}; y = 10000; > > elist = Flatten[ConstantArray[#, IntegerPart[y/#]] & /@ aris]; > > n = 1; > ariList = Reverse[{N[y/n++], #} & /@ elist] > > ListLogLogPlot[{ariList, {{1, 1}, {100000, 100000}}}, > PlotRange -> All, InterpolationOrder -> {0, 1}, Joined -> True, > Filling -> {2 -> {{1}, {Yellow, Orange}}}] > > If I define a interpolation function myself it works, but it is a bit > of a nuisance > > f[x_] = Interpolation[ariList, InterpolationOrder -> 0][x]; > > LogLogPlot[{f[x], x}, {x, 10, 10000}, > Filling -> {2 -> {{1}, {Yellow, Orange}}}] > > Is there a way of making it work correctly with ListPlot ? Would this > be a bug ? > > Best > F.
From: dh on 20 Nov 2009 06:55 fd wrote: > All > > I'm having problems with Filling in ListPlot. I have two curves and > would like different colors as one curve goes above the other, here > goes the code; > > aris = {10000, 5000, 1000, 500, 100, 50, 20}; y = 10000; > > elist = Flatten[ConstantArray[#, IntegerPart[y/#]] & /@ aris]; > > n = 1; > ariList = Reverse[{N[y/n++], #} & /@ elist] > > ListLogLogPlot[{ariList, {{1, 1}, {100000, 100000}}}, > PlotRange -> All, InterpolationOrder -> {0, 1}, Joined -> True, > Filling -> {2 -> {{1}, {Yellow, Orange}}}] > > If I define a interpolation function myself it works, but it is a bit > of a nuisance > > f[x_] = Interpolation[ariList, InterpolationOrder -> 0][x]; > > LogLogPlot[{f[x], x}, {x, 10, 10000}, > Filling -> {2 -> {{1}, {Yellow, Orange}}}] > > > Is there a way of making it work correctly with ListPlot ? Would this > be a bug ? > > Best > F. > > > > > > > Hi, there seems to be a bug with interpolation and filling. The filling seems not to take interpolation into account. Consider the following, setting n1=10, 100, 1000, 10000: n1 = 10; ListLogLogPlot[{ariList, Table[{x, x}, {x, 1, 10000, n1}]}, PlotRange -> All, Joined -> True, InterpolationOrder -> {0, 1}, Filling -> {2 -> {{1}, {Red, Blue}}}] Daniel
|
Pages: 1 Prev: mixed ByteOrdering Next: More Efficient Method |