From: Wesley M. <mo...@ch...> - 2004-05-17 23:58:28
|
On Mon, 17 May 2004, Ethan Merritt wrote: > On Monday 17 May 2004 03:53 pm, Wesley Morgan wrote: > > Has there been any discussion about integrating support for plotting > > results of queries from database backends? Like many people, I have a > > tremendous amount of data in databases but the only way to plot it in > > gnuplot is with complicated systems of pipes or exporting to text files. > > Some of us in the unix world hold the contrary view, that pipes and > text files are the easy and uncomplicated way to go. What did you > have in mind as an alternative? I'm simply thinking that I would like to be able to execute something like this... set dbserver 'localhost' set dbname 'test' set dbuser 'test' plot 'select * from table' with lines <ask for password if necessary> <plot away> Rather than have to create a data file, or pipe data from another program to gnuplot. I don't know about you but it seems a lot less complicated to me (and I hail from many years of unix, ;)). You could optionally keep the query result around until another is issued for use with replot to save some work on the backend. As you see, I'm not looking for an interface TO gnuplot, the command line works quite well for me. I'm more curious as to how difficult it would be to add this functionality to gnuplot itself. It already supports a tremendous range of output formats, so why not accept a few more input methods? Adding support for a few db backends would surely be very similar (if not easier) than reading data files. > > What kind of function 'hooks' would need to be provided to the plotting > > routines to accomplish this? > > There are interfaces to gnuplot through > java: > http://www.is.informatik.uni-duisburg.de/projects/java-unidu/api/de/unidu/is/gnuplot/Gnuplot.html > perl: > http://search.cpan.org/~ilyaz/Term-Gnuplot-0.5704/Gnuplot.pm > python: > http://gnuplot-py.sourceforge.net/ -- Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! |
From: GANNOUNE L. <Las...@ei...> - 2004-07-08 07:04:32
|
Please I would like to unsubscribe from this list.=20 =20 Regards, =20 Lassaad =20 =20 =20 |
From: <em...@ru...> - 2004-10-29 15:57:43
|
Hello I've just recently updated to gnuplot 4.0 from 3.7.0, and I'm loving it! The mousing features make it more appealing for dealing with spectra, and as such there's a feature I'd like to put in some time. I have to plot lots of infrared spectra, and because of the nature of the data it's not very instructive to plot it on an ordinary linear scale. The older convention was to make the x-axis logarithmic, and early instruments actually had a log plotter tied mechanically to the guts of the spectrometer. With the advent of FT-IR instruments, the preferred way became to use a combination of two linear scales on the x-axis. So, your x-axis might look like this: ... +----------+----------+----------+----------+----------+----------+ ... 2800 2400 2000 1800 1600 1400 1200 For mid-infrared spectra, the data follows the first linear scale (say 400 wavenumbers per inch) down to 2000 wavenumbers, whereafter the scale changes to 200 wavenumbers per inch. It's much the same effect as a log scale, of course, but it just makes it easier to work out at a glance where you are on the scale without the use of funny paper. My thought (without having delved deeply into the source code, I must admit) is to give the user one more type of scale much like logscale which they can select. So one might go set irscale to get this kind of scale. I'm not so sure what do with things like xrange and so on, and perhaps some optional arguments might be in order to tell the program where to do what, although there's not much need for customization here. Do you think this might be worth adding? If so, can you think of a better way to implement it, from the user's point of view? I'd like to have some expert opinions before I start messing around too much. Just now someone tells me there's a simple way to do this already ;) Regards, Emmanuel |
From: Daniel J S. <dan...@ie...> - 2004-10-29 16:38:12
|
em...@ru... wrote: >... +----------+----------+----------+----------+----------+----------+ ... > 2800 2400 2000 1800 1600 1400 1200 > > > > set irscale > >Do you think this might be worth adding? If so, can you think of a better >way to implement it, from the user's point of view? I'd like to have some >expert opinions before I start messing around too much. Just now someone tells >me there's a simple way to do this already ;) > This can be done by passing the x data through a nonlinear function, and then manually altering the x-tics so they reflect the numbers accurate, for example as you've given above. (The supplying of the tics is the tedious part... and you *must* always make sure that the tics break right at a location where the nonlinear scaling changes... otherwise there is no meaningful way to interpret the data) As an example, try the following: plot 'battery.dat' using 1:2 vs. plot 'battery.dat' using ((($1)<=20)*($1) + (($1)>20)*(($1-20)*0.5 )):2+20)):2 Of course, this is very tedious. But those who are accomplished with the awk scripts in gnuplot might be able to suggest if this can be made easy. I think "irscale" is too specific to be of use in gnuplot. However, a more generalized description or name of what you are suggesting might be "piece-wise-linear" scales. Dan |
From: Daniel J S. <dan...@ie...> - 2004-10-29 16:44:18
|
In looking at this scale thing I mistyped and forgot some parentheses in the using string. The result was something I did not expect. For example, plot 'battery.dat' using 1:2 and then plot 'battery.dat' using 1:log(2) plot 'battery.dat' using 1:sin(2) The second plot, is that or is that not making sense? Dan |
From: Ethan M. <merritt@u.washington.edu> - 2004-10-29 16:59:21
|
On Friday 29 October 2004 09:45 am, Daniel J Sebald wrote: > plot 'battery.dat' using 1:log(2) > plot 'battery.dat' using 1:sin(2) > > The second plot, is that or is that not making sense? Neither command makes any sense to me. I thought that a "using" specifier had to be either a bare number or an expression in parentheses. But whatever it's doing, it was already doing it in version 3.7 -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |
From: Hans-Bernhard B. <br...@ph...> - 2004-10-29 17:30:29
|
Daniel J Sebald wrote: > plot 'battery.dat' using 1:log(2) > plot 'battery.dat' using 1:sin(2) > > The second plot, is that or is that not making sense? They're both making a perverse kind of sense. 'Using' specifiers classify as extended or not depending on the presence of 'extra' enclosing parentheses, and those alone. In this sense using 1:sin(2) is just an overly complicated way of writing 'using 1:0' This can be useful in the case where you want to loop over column numbers, or have any other reason to calculate column numbers on the spot rather than hard coding them on the spot. E.g. consider this script: p 'file.dat' u 1:n n = n + 1 if (n<20) reread |
From: Ethan M. <merritt@u.washington.edu> - 2004-05-18 00:16:49
|
On Monday 17 May 2004 04:58 pm, Wesley Morgan wrote: > I'm simply thinking that I would like to be able to execute something > like this... > > set dbserver 'localhost' > set dbname 'test' > set dbuser 'test' > plot 'select * from table' with lines > <ask for password if necessary> > <plot away> I'm lost. What is this snippet supposed to represent? Are these commands to gnuplot? > As you see, I'm not looking for an interface TO gnuplot, the command > line works quite well for me. I'm more curious as to how difficult it > would be to add this functionality to gnuplot itself. It already > supports a tremendous range of output formats, so why not accept a few > more input methods? But isn't that just another pipe, or anyway a pair of pipes? What is different about this input to gnuplot that distinguishes it from any other input to gnuplot? If I understand what you are trying to do, you should be able to send your commands *to* the database with shell escapes and read the output *from* the database via a pipe. Something more or less like: gnuplot> ! mkfifo ./database_out gnuplot> ! db 'select * from table' > ./database_out gnuplot> plot '< ./database_out' with lines -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |
From: Wesley M. <mo...@ch...> - 2004-05-18 00:55:04
|
On Mon, 17 May 2004, Ethan Merritt wrote: > On Monday 17 May 2004 04:58 pm, Wesley Morgan wrote: > > I'm simply thinking that I would like to be able to execute something > > like this... > > > > set dbserver 'localhost' > > set dbname 'test' > > set dbuser 'test' > > plot 'select * from table' with lines > > <ask for password if necessary> > > <plot away> > > I'm lost. What is this snippet supposed to represent? > Are these commands to gnuplot? Yes, exactly. > > As you see, I'm not looking for an interface TO gnuplot, the command > > line works quite well for me. I'm more curious as to how difficult it > > would be to add this functionality to gnuplot itself. It already > > supports a tremendous range of output formats, so why not accept a few > > more input methods? > > But isn't that just another pipe, or anyway a pair of pipes? > What is different about this input to gnuplot that distinguishes it > from any other input to gnuplot? Well by "input" I meant data not commands. > If I understand what you are trying to do, you should be able > to send your commands *to* the database with shell escapes > and read the output *from* the database via a pipe. > Something more or less like: > > gnuplot> ! mkfifo ./database_out > gnuplot> ! db 'select * from table' > ./database_out > gnuplot> plot '< ./database_out' with lines Yes, but isn't that much more complicated than simply gnuplot itself supporting a direct connection to the db? :> -- Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! |
From: Wesley M. <mo...@ch...> - 2004-05-18 01:54:54
|
On Mon, 17 May 2004, Ethan Merritt wrote: > On Monday 17 May 2004 05:54 pm, you wrote: > > > Something more or less like: > > > > > > gnuplot> ! mkfifo ./database_out > > > gnuplot> ! db 'select * from table' > ./database_out > > > gnuplot> plot '< ./database_out' with lines > > > > Yes, but isn't that much more complicated than simply gnuplot itself > > supporting a direct connection to the db? :> > > I don't know. > I still don't understand what you have in mind, maybe because > I'm not a database guy. > > Isn't every database going to have its own set of commands? That's what SQL is for :) > How is gnuplot ever going to know what to send other than just > passing through what you type? I used a fifo in my example to > show you that it can be done that way, but for the simple case > at hand you can do it all in a single command anyhow: > > plot "< db 'select * from table'" with lines > > or whatever the database command might be. What syntax did > you have in mind that would be simpler? The thing is that databases like mysql and postgres, the two most used OSS servers, don't output useable data by default (it's "pretty print"), so you would have to learn the somewhat cumbersome and irritating syntax to fix this (although you could write another passthrough shell command for it). Some databases may not even have a command-line client. If gnuplot had support for several different backends, you could plot data from any of them with ease, not needing to worry about differences in arguments etc. Just simple SQL. Anyhow.. Is there any kind of documentation on the gnuplot internals, or am I better off reading the source? -- Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! |
From: Petr M. <mi...@ph...> - 2004-05-18 06:25:07
|
> > How is gnuplot ever going to know what to send other than just > > passing through what you type? I used a fifo in my example to > > show you that it can be done that way, but for the simple case > > at hand you can do it all in a single command anyhow: > > > > plot "< db 'select * from table'" with lines > > > > or whatever the database command might be. What syntax did > > you have in mind that would be simpler? > > The thing is that databases like mysql and postgres, the two most used OSS > servers, don't output useable data by default (it's "pretty print"), so > you would have to learn the somewhat cumbersome and irritating syntax to > fix this (although you could write another passthrough shell command for > it). Some databases may not even have a command-line client. If gnuplot > had support for several different backends, you could plot data from any > of them with ease, not needing to worry about differences in arguments > etc. Just simple SQL. > > Anyhow.. Is there any kind of documentation on the gnuplot internals, or > am I better off reading the source? I propose you write a "simple" C/C++/awk/perl program what would do the above you want gnuplot to do. This program would output just two columns on its standard output according to your select. This way, you can fully implement your idea but still don't put plenty of new code and external libraries into gnuplot. If your program is working, it can be referenced from gnuplot web page. Note that gnuplot is used this way for accessing other specific data formats, for example structured data files from synchrotron experiments. Loading dynamical functions would be another solution. But piping works OK. -- PM |