3
$\begingroup$

I am trying to produce a plot showing the variation in a sample of functions. It should look like this plot or that plot. I tried to use SmoothDensityHistogram. Even for the following simple example this does not look right. Do you have other suggestions?

My approach so far was:

dx = 0.01;
functionSample = 
Table[noise = Random[NormalDistribution[0, 0.5]]; 
Table[ {x, x (1 - x) + noise}, {x, 0, 1, dx}], {i, 1, 60}];
var = Flatten[diff, 1];
ListPlot[functionSample[[All, All]], Joined -> True]
SmoothDensityHistogram[var, 
ColorFunction -> (Blend[{White, Black}, #] &)]

Producing

ListPlotSmoothDensityHistogram

Maybe things can be improved by choosing a small bandwidth of the kernel in x direction and a larger in y direction of the underlying kernel smoother.

$\endgroup$
4
$\begingroup$

Just for visualisation purposes you can use Filling:

dx = 0.01;
n = 10;
functionSample = Table[noise = Random[NormalDistribution[0, 0.5]];
                       Table[{x, x (1 - x) + noise}, {x, 0, 1, dx}]
                      , {i, 1, n}];


ListPlot[Evaluate[{Mean[{##}], ##} & @@ functionSample], 
         Joined -> True, Filling -> (# -> {1} & /@ Range[2, n + 1]), 
         PlotStyle -> {Directive[Thickness@.02, Orange], Sequence @@ Array[Thin &, n]}, 
         FillingStyle -> Directive[Opacity@.3, Gray]]

enter image description here

PlotStyle -> {Directive[Thickness@.02, Orange], Sequence @@ Array[None &, n]}, 
FillingStyle -> Directive[Opacity@.1, Gray]

enter code here

$\endgroup$

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.