Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jan 2020 15:29:14 +0100
From:      Polytropon <freebsd@edvax.de>
To:        thor <thor@irk.ru>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Src of any simple data plotting graphic program under X-Windows needed
Message-ID:  <20200102152914.e98bb8ee.freebsd@edvax.de>
In-Reply-To: <9e461c4b-bd0e-8c3e-5b78-77d59afcc6a5@irk.ru>
References:  <9e461c4b-bd0e-8c3e-5b78-77d59afcc6a5@irk.ru>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Thu, 2 Jan 2020 22:00:49 +0800, thor wrote:
> I need some specialized program that should just read a data file and 
> plot it in X-windows. No dependencies, no toolkits - just an absolutely 
> bare minimum. I just have neither a disk space on target system for any 
> specialized toolkits nor time to study them.

I'd suggest GNUplot. It can process "linear" data as well
as CSV files, and write to the X display or to an image
file (or EPS).



> Long time ago (some 20 years or so) in FreeBSD 3 times I used a 
> primitive program named xperfmon3 that plotted the current processor use 
> etc but it expired due to absence of a maintainer and I cannot find it.

Yes, I remember that program.

In case you want to plot system usage data, check out
xload, xmbmon, xcpufreq.



> Are there in port tree any similar simple programs that could be used as 
> a prototype?

If your data is simple, and your displaying requirements
are simple, you can probably write your own solution using
toools like Perl or Python, where there are plenty of
libraries and examples for data plotting. In case you don't
want to deal with that, consider testing gnuplot, even though
it's not exactly "lightweight" in terms of dependencies...

For example, if this is your data:

	 1 12.5
	 2 13.5
	 3 14.8
	 4 14.2
	 5 13.2
	 6 14.0
	 7 14.9
	 8 13.6
	 9 14.9
	10 15.8
	11 13.3
	12 13.7

You can use the following gnuplot control file to plot them:

	set title '2008 (12.9)'
	set size 3.0, 1.0
	set xr [1:12]
	set yr [0.0:25.0]
	set border
	set grid
	set xtics 1, 1
	set ytics 0, 5
	plot '2008.dat' using 1:2 title 'BZ' with lines linewidth 5
	set term postscript eps color
	set output '2008.eps'
	replot

Further postprocessing is possible (in this specific case, I
used awk, LaTeX, and a sh wrapper for automated document
generation and data export files).

Basically, you can use gnuplot without a control file - in most
cases, the data files will be plotted as you expect, or you can
embed the data in the control files (only useful for smaller
amounts of data and "single use" situations, or for experimenting
with the parameters). For similarly structured data, you can use
one control file to process many input data files.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20200102152914.e98bb8ee.freebsd>