How To Create A Persistence Plot

24 visualizzazioni (ultimi 30 giorni)
DrEamonn
DrEamonn il 9 Ago 2020
Commentato: Star Strider il 11 Ago 2020
I have quite a large data set that I want to visulaise by overlaying all the traces on one plot, with the traces only using one colour & the opacity/brightness of the resulting trace determined by how many instances of a particular value occur at each point - the only thing I can think to compare it to would be persistence on an old school oscilloscope.
Can someone point me to the correct plot type to achieve this or help me out with some code?
Thanks
  5 Commenti
DrEamonn
DrEamonn il 10 Ago 2020
This is similar to what I had in mind.
The main difference between the above & what I would like to achieve is that I would like the opacity to vary depending on denisty of values i.e. simialr to an old school oscilloscope display with persistence.
Adam Danz
Adam Danz il 10 Ago 2020
Modificato: Adam Danz il 10 Ago 2020
As far as I know you cannot vary the transparency within a patch. However, you can adjust the color (ie, shades of blue) and then set a constant transparency value.
Here's some background info on controlling the color transitions of a patch by setting the CData property of a patch object. You can set a colormap from light blue to dark blue.

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 10 Ago 2020
Perhaps something like this:
x = linspace(0, 10, 250); % Create Data
y = randn(10,1) .* sin(2*pi*x + randn(10,1)); % Create Data
figure
plot(x, y) % Original Waveforms
grid
colMin = min(y);
colMax = max(y);
colMean = mean(y);
figure
plot(x, colMean) % Data Mean
hold on
patch([x fliplr(x)], [colMin fliplr(colMax)], 'b', 'FaceAlpha',0.2, 'EdgeColor','none') % Shaded Range
hold off
grid
producing:
This can likely be changed to show other results.
.
  10 Commenti
DrEamonn
DrEamonn il 11 Ago 2020
I have run some experiements & have a question:
The first plot shows the data plotted using 'plot()'
The second shows the same data plotted using the Start Strider's code:
Why is the highest value on the second plot higher than the first if it is plotted using the same data?
Star Strider
Star Strider il 11 Ago 2020
Why is the highest value on the second plot higher than the first if it is plotted using the same data?
My code creates the gradients with reference to the standard deviations of the data, going from -3 to +3, corresponding to probabilities of the data being in that range of 0.0013499 to 0.9986501, so a probability of 0.005 that the data will be included within those limits. If you prefer that they have different limits, set ‘stdMult’ to a different range, perhaps using linspace:
stdMult = linspace(-2, 2, 15);
The limits must be symmetrical, and an odd number of elements appears to work best. You can experiment with and design the probabilities using normcdf (that will produce the associated probabilities from the elements of ‘stdMult’) and norminv (that will produce the limits for ‘stdMult’ from the chosen probability).

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by