Timeseries histograms with gnuplot
Werner Lippert <[email protected]> Tue, 6 Feb 2024 20:08:45 +0000
| Newsgroups | gmane.comp.graphics.gnuplot.user |
|---|---|
| Message-ID | <[email protected]> |
Hello gnuplot enthusiasts, I have been using gnuplot for like 15 years to create timeseries charts for all kinds of timeseries data, fairly basic linegraphs (multiplot etc. but still simple) but also histograms. As this feature (timeseries histograms) is not available, or I am not aware of, I use a sort of workaround to emulate histograms. Attached is a sample graph and the gnuplot description (I call them .gpl files). They look nice but can but become very slow, when many instances are involved, many meaning more than 1 or 2 hundred and gnuplot execution times cat go up to 1 min on a M3 MacBook Pro. The way it works to emulate the histogram mechanism is, it iterates over all instances, plotting the sum of all n instances including the n-th instance first (using boxes!), then overlays the sum of n-1 instances excluding the top instance, then n-2 and so on until all the instances are dealt with. For each timestamp in the data. It’s pretty obvious that this algorithm is not efficient when it comes to a large number of instances. Especially as I use boxes fill solid. The data is sorted first, with instance 2 (CL3-K) being the “top” instance, that is having the highest sum of all values over all timestamps. The top instance “sits” on the x-axis, the instance with the lowest contribution sits on top of the histogram. The contribution of each instance to the overall total of all instances is provided in brackets, like [#[email protected]%] meaning rank #1 with 24.06 %. Just to be complete. My question(s): (1) is there a built-in timeseries histogram feature available in gnuplot that would make my workaround obsolete? It should work with a fairly large number of timestamps in the data, like up to 2’000 with time resolution. Or (2) Can I implement a function that starts with sum (all instances) and then on each line subtracts the values of the current line? Or (3) any other idea? My expectation is a factor of 10 at least faster execution. Am I being unrealistic? Here is my description for the 10 highest instances: timeseries using 1:(sum [col= 2:10] column(col)) t "CL1-A[#[email protected]%]" lc rgb "#2EFE2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:9] column(col)) t "CL2-A[#[email protected]%]" lc rgb "#64FE2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:8] column(col)) t "CL1-B[#[email protected]%]" lc rgb "#9AFE2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:7] column(col)) t "CL2-B[#[email protected]%]" lc rgb "#C8FE2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:6] column(col)) t "CL6-C[#[email protected]%]" lc rgb "#F7FE2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:5] column(col)) t "CL2-J[#[email protected]%]" lc rgb "#FACC2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:4] column(col)) t "CL1-J[#[email protected]%]" lc rgb "#FE9A2E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:3] column(col)) t "CL4-K[#[email protected]%]" lc rgb "#FE642E" with boxes fill solid noborder, \ timeseries using 1:(sum [col= 2:2] column(col)) t "CL3-K[#[email protected]%]" lc rgb "#FE2E2E" with boxes fill solid noborder I am absolutely happy to share the mechanism how to create nice looking gnuplot timeseries charts if you would like to add them to the samples, as I think timeseries are an important use case and it should be unnecessary to invent the wheel over and over again. If this is not the proper channel to ask for help for this kind of use case, please accept my apologies for bothering you. Cheers, Werner _________________________________________________ Dr. Werner Lippert Partner peaq GmbH Mobile +41 79 218 84 26 Neugutstrasse 12 [email protected] CH-8304 Wallisellen www.peaq.ch _________________________________________________ Get the most out of your Hitachi Storage Systems With peaq IOportal, SAM4H, Crosscharging and Lifecycle Services _______________________________________________ gnuplot-info mailing list [email protected] Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info