So I have about 100 different curves and I’d like to create a heatmap from them. These curves each represent possible solutions to a differential equation and I’d like to create a sort of density plot from them so that in every point in time I can have a 2D smooth kernel histogram. I append an example I made in python. It was done creating a histogram at every point in time but it was really slow and not too visually appealing
Any help will be greatly appreciated!
EDIT: To be more clear. I generate a 100 parameters “p” to a differential equation y’ = f(t, p)and integrate using those parameters and the same set of initial conditions to generate 100 solutions. What I’d like is a plot where t is on the horizontal axis, y on the vertical one and the colour intensity is given by how many of those 100 solutions pass through the point (t, y)
It’s more like time is in the horizontal axis, f(t) is the vertical axis and the height is given by how many curves pass through a point (t, f(t)). I’ll try to generate a MWE if it’s not that clear but I might not be able to do it
Given that you have a lot of points, a contourf sounds more adapted ?
Assuming you have p(x,t) for each x and t create a matrix out of it and give x and t for horizontal and vertical axis.
using Distributions, Plots
x = range(-5, 5, length = 100);
s = range(0.01, 3.0, length = 100);
Z = reduce(hcat, [pdf(Normal(0, exp(sig)), x) for sig in s])
contourf(x, s, Z', xlabel = "x", ylabel = "sig")
Note that you can still replace contourf by heatmap to get more or less the same result