|
From: Manuel S. <man...@gm...> - 2008-07-17 21:29:20
Attachments:
main.c
|
Hi guys,
I often use commands like
plot "afile" w l <and many more options>, \
"anotherfile" w l <the same options>, \
...
So I implemented an auto completion feature for this, so you can use it
like this:
plot "" <all your options>
^ place cursor here and press <tab>
result:
plot "file1" <all your options>,
"file2" <all your options>,
"file3" <all your options>
There is an minimal example application attached to this email but in
this preprocessor command mix I cannot figure out where to place the
rl_bind_key command in the gnuplot source code.
It would be great if you could tell me where to place this command so I
can create a patch for this feature.
Please note that its feature should not remove the current <tab> feature
and will via Alt+C or something.
Cheers,
Manuel
|
|
From: Ethan M. <merritt@u.washington.edu> - 2008-07-18 22:00:28
|
On Thursday 17 July 2008 14:31, Manuel Schölling wrote: > Hi guys, > > I often use commands like > > plot "afile" w l <and many more options>, \ > "anotherfile" w l <the same options>, \ > ... > > So I implemented an auto completion feature for this, so you can use it > like this: > > plot "" <all your options> > ^ place cursor here and press <tab> > result: > plot "file1" <all your options>, > "file2" <all your options>, > "file3" <all your options> How is this different from the auto-completion that libreadline does already? In other words, is your patch adding the auto-completion capability to gnuplot's built-in readline, or is it something added on top of libreadline? > There is an minimal example application attached to this email but in > this preprocessor command mix I cannot figure out where to place the > rl_bind_key command in the gnuplot source code. > > It would be great if you could tell me where to place this command so I > can create a patch for this feature. > > Please note that its feature should not remove the current <tab> feature > and will via Alt+C or something. > > Cheers, > Manuel > > -- Ethan A Merritt Courier Deliveries: 1959 NE Pacific Dept of Biochemistry Regular Mail: Mailstop 357742 Health Sciences Building University of Washington - Seattle WA 98195-7742 |
|
From: Lutz M. <lut...@gm...> - 2008-07-18 22:23:27
|
On Thursday 17 July 2008 14:31:20 Manuel Schölling wrote: > So I implemented an auto completion feature for this, so you can use it > like this: > > plot "" <all your options> > ^ place cursor here and press <tab> > result: > plot "file1" <all your options>, > "file2" <all your options>, > "file3" <all your options> I have no answer to your question, but your email reminded me of a feature that I think would be very nice to have, the support of wildcards in filenames. For example, the gnuplot command plot "file[1-3]" <all your options> would expand to what you suggest. This approach would also work in scripts, whereas your implementation seems to work only in interactive gnuplot sessions. Lutz |
|
From: Ethan M. <merritt@u.washington.edu> - 2008-07-18 22:46:22
|
On Friday 18 July 2008 15:23:34 Lutz Maibaum wrote: > On Thursday 17 July 2008 14:31:20 Manuel Schölling wrote: > > So I implemented an auto completion feature for this, so you can use it > > like this: > > > > plot "" <all your options> > > ^ place cursor here and press <tab> > > result: > > plot "file1" <all your options>, > > "file2" <all your options>, > > "file3" <all your options> > > I have no answer to your question, but your email reminded me of a feature > that I think would be very nice to have, the support of wildcards in > filenames. For example, the gnuplot command > > plot "file[1-3]" <all your options> > > would expand to what you suggest. This approach would also work in scripts, > whereas your implementation seems to work only in interactive gnuplot > sessions. We already have that: plot for [i=1:3] "file".i <all your options> -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle 98195-7742 |
|
From: Lutz M. <lut...@gm...> - 2008-07-19 01:41:06
|
On Friday 18 July 2008 15:46:27 Ethan Merritt wrote: > On Friday 18 July 2008 15:23:34 Lutz Maibaum wrote: > > I have no answer to your question, but your email reminded me of a > > feature that I think would be very nice to have, the support of > > wildcards in filenames. > > plot "file[1-3]" <all your options> > We already have that: > > plot for [i=1:3] "file".i <all your options> Thanks, Ethan, I didn't know about plot iterations. It seems like they are limited to integers, are there any plans to allow iterations over string lists? It would be great if one could do something like plot for (filename in test*.dat) i <all your options> or at least plot for (filename in `ls test*.dat`) i <all your options> Right now it seems like I would have to do something like list="`ls test*.dat`" plot for [i=1:words(list)] word(list,i) which actually does not work, since calling ls through backticks generates a list with only a single item in it: gnuplot> !ls test*.dat test1.dat test2.dat gnuplot> list="`ls test*.dat`" gnuplot> print word(list,1) test1.dattest2.dat -- Lutz |
|
From: <pl...@pi...> - 2008-07-19 09:18:19
|
On Sat, 19 Jul 2008 03:41:02 +0200, Lutz Maibaum <lut...@gm...>
wrote:
> list="`ls test*.dat`"
> plot for [i=1:words(list)] word(list,i)
> which actually does not work, since calling ls through backticks
> generates
> a list with only a single item in it:
> gnuplot> !ls test*.dat
> test1.dat test2.dat
> gnuplot> list="`ls test*.dat`"
> gnuplot> print word(list,1)
> test1.dattest2.dat
> -- Lutz
even though Ethan has given a way to do this with system(), doesn't this
output indicate a bug in the way several lines are concatenated into one
useless string.
Not sure what the right output from this should be. First string, last
string, space separated concatenation or concat containing line break
ASCII 13 ??
One thing seems sure the current output "test1.dattest2.dat" is not a
valid solution and can never be useful.
However,
plot for [i=1:words(list)] word(list,i) title word(list,i)
looks highly useful.
/regards.
|
|
From: Theo H. <th...@ph...> - 2008-07-19 14:02:12
|
Lutz Maibaum wrote: > On Friday 18 July 2008 15:46:27 Ethan Merritt wrote: >> On Friday 18 July 2008 15:23:34 Lutz Maibaum wrote: >>> I have no answer to your question, but your email reminded me of a >>> feature that I think would be very nice to have, the support of >>> wildcards in filenames. > >>> plot "file[1-3]" <all your options> > >> We already have that: >> >> plot for [i=1:3] "file".i <all your options> > > Thanks, Ethan, I didn't know about plot iterations. It seems like they are > limited to integers, are there any plans to allow iterations over string > lists? It would be great if one could do something like > > plot for (filename in test*.dat) i <all your options> > > or at least > > plot for (filename in `ls test*.dat`) i <all your options> > > Right now it seems like I would have to do something like > > list="`ls test*.dat`" > plot for [i=1:words(list)] word(list,i) > > which actually does not work, since calling ls through backticks generates > a list with only a single item in it: > > gnuplot> !ls test*.dat > test1.dat test2.dat > gnuplot> list="`ls test*.dat`" > gnuplot> print word(list,1) > test1.dattest2.dat Using list="`echo test*.dat`" works fine here. Filenames are separated by spaces, as expected for use with word(). THeo |
|
From: Manuel S. <man...@gm...> - 2008-07-19 11:42:53
|
Lutz Mainbaum wrote:
> I have no answer to your question, but your email reminded me of a feature
> that I think would be very nice to have, the support of wildcards in
> filenames. For example, the gnuplot command
>
> plot "file[1-3]" <all your options>
>
> would expand to what you suggest. This approach would also work in scripts,
> whereas your implementation seems to work only in interactive gnuplot
> sessions.
Ethan Merritt wrote:
> We already have that:
>
> plot for [i=1:3] "file".i <all your options>
This is strange. Both commands do not work here:
I have the data files /tmp/file[1-3] and this is the output of gnuplot:
G N U P L O T
Version 4.2 patchlevel 3
last modified Mar 2008
System: Linux 2.6.25-tuxonice-r1
Copyright (C) 1986 - 1993, 1998, 2004, 2007, 2008
Thomas Williams, Colin Kelley and many others
Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from http://www.gnuplot.info/faq/
Send bug reports and suggestions to
<http://sourceforge.net/projects/gnuplot>
Terminal type set to 'x11'
gnuplot> plot for [i=1:3] "/tmp/file".i w l
^
':' expected
gnuplot> plot "/tmp/file[1-3]" w l
warning: Skipping unreadable file "/tmp/file[1-3]"
No data in plot
I'm using Gentoo Linux with these USE flags
[I] sci-visualization/gnuplot
Available versions: 4.2.2-r1 4.2.3-r2 {X doc emacs gd ggi latex
pdf plotutils readline svga wxwindows xemacs}
Installed versions: 4.2.3-r2(22:12:41 15.06.2008)(X emacs gd ggi
latex pdf plotutils readline -doc -svga -wxwindows -xemacs)
Homepage: http://www.gnuplot.info/
Description: Command-line driven interactive plotting program
If you have a clue what's wrong here, please send me a mail.
But nevertheless, if you use these commands you've written you don't
have the possibility to add further plotting options like a different
title for each data file.
Cheers,
Manuel
|
|
From: Ethan A M. <merritt@u.washington.edu> - 2008-07-19 16:33:06
|
On Saturday 19 July 2008, Manuel Schölling wrote:
> Ethan Merritt wrote:
> > We already have that:
> >
> > plot for [i=1:3] "file".i <all your options>
>
> This is strange. Both commands do not work here:
It is a feature in the development version (4.3).
> But nevertheless, if you use these commands you've written you don't
> have the possibility to add further plotting options like a different
> title for each data file.
Sure you do. The iteration variable can be used multiple times.
Here's a trivial example:
plot for [i=i,N] "file".i with lines title "file".i
Or, if you want custom titles:
name = "Apples Oranges Bananas"
plot for [i=1,3] "file".i with lines title word(name,i)
--
Ethan A Merritt
|
|
From: Ethan A M. <merritt@u.washington.edu> - 2008-07-19 04:14:49
|
On Friday 18 July 2008, Lutz Maibaum wrote:
> On Friday 18 July 2008 15:46:27 Ethan Merritt wrote:
> > On Friday 18 July 2008 15:23:34 Lutz Maibaum wrote:
> > > I have no answer to your question, but your email reminded me of a
> > > feature that I think would be very nice to have, the support of
> > > wildcards in filenames.
>
> > > plot "file[1-3]" <all your options>
>
> > We already have that:
> >
> > plot for [i=1:3] "file".i <all your options>
>
> Thanks, Ethan, I didn't know about plot iterations. It seems like they are
> limited to integers, are there any plans to allow iterations over string
> lists? It would be great if one could do something like
>
> plot for (filename in test*.dat) i <all your options>
>
> or at least
>
> plot for (filename in `ls test*.dat`) i <all your options>
>
> Right now it seems like I would have to do something like
>
> list="`ls test*.dat`"
> plot for [i=1:words(list)] word(list,i)
>
> which actually does not work
It works. You just have to use a slight variant:
list = system("ls test*.dat")
plot for [i=1:words(list)] word(list,i) title word(list,i)
I have toyed with the idea of having an explicit string iterator that
would do this automatically, something like
list = system("ls *.dat")
plot for [FILE in list] FILE
but it turns out to require more code than I would have guessed, and
it didn't seem worth it since the capability is there already.
But if someone has a clever idea for implementation perhaps there is
an easier way than I found at the time.
--
Ethan A Merritt
|
|
From: Ethan M. <merritt@u.washington.edu> - 2008-07-21 20:36:42
|
On Friday 18 July 2008 21:10:12 Ethan A Merritt wrote:
> On Friday 18 July 2008, Lutz Maibaum wrote:
> > It would be great if one could do something like
> >
> > plot for (filename in test*.dat) i <all your options>
> >
>
> I have toyed with the idea of having an explicit string iterator that
> would do this automatically, something like
>
> list = system("ls *.dat")
> plot for [FILE in list] FILE
>
> but it turns out to require more code than I would have guessed, and
> it didn't seem worth it since the capability is there already.
I had another look over the weekend. Either I missed the obvious before,
or we have better support routines in place now. In any event, the extra
code to implement this was quite small. So I have added to CVS support
for the variant:
plot for [ <variablename> in "string of words" ] ....
--
Ethan A Merritt
|