|
From: Sylwester A. <sa...@ig...> - 2013-03-05 21:04:41
|
Hello,
The commands below exemplify a buggy behaviour of the svg terminal:
$ cat bug.gpi
set term svg
set view map
set output system("date +%X").".svg"
splot '-' matrix with image notitle
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 2 0 0 0 3 3 0 0
0 0 1 0 1 0 2 0 2 0 3 0 3 0 0
0 0 1 1 0 0 2 0 2 0 3 0 0 0 0
0 0 1 0 1 0 2 0 2 0 3 0 0 0 0
0 0 1 1 0 0 2 0 2 0 0 3 3 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
e
$ gnuplot bug.gpi
$ gnuplot bug.gpi
$ ls -1 *
21:55:23.svg
21:55:26.svg
bug.gpi
gp_image_01.png
The problem is that both 21:55:23.svg and 21:55:26.svg include the same
gp_image_01.png file, while the plotted data could in principle be
different in the two svg files. Changing the prefix of the png file from
gp_image_ to something like 21:55:23.svg_image_ would fix the problem.
HTH,
Thanks,
Sylwester
--
http://www.igf.fuw.edu.pl/~slayoo/
|
|
From: Christoph B. <us...@be...> - 2013-03-06 09:02:30
|
Hi,
Hi,
Am 05.03.2013 22:04, schrieb Sylwester Arabas:
>
> The problem is that both 21:55:23.svg and 21:55:26.svg include the same
> gp_image_01.png file, while the plotted data could in principle be
> different in the two svg files. Changing the prefix of the png file from
> gp_image_ to something like 21:55:23.svg_image_ would fix the problem.
you can use the 'name' option of the svg terminal:
filename = system("date +%X | tr : _")
set term svg name filename
set view map
set output filename.".svg"
splot '-' matrix with image notitle
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 2 0 0 0 3 3 0 0
0 0 1 0 1 0 2 0 2 0 3 0 3 0 0
0 0 1 1 0 0 2 0 2 0 3 0 0 0 0
0 0 1 0 1 0 2 0 2 0 3 0 0 0 0
0 0 1 1 0 0 2 0 2 0 0 3 3 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
e
I replaced the : by _ in the filename, because 'name' takes only
alphanumeric characters and _. (Don't know why)
Christoph
|
|
From: Sylwester A. <sa...@ig...> - 2013-03-06 10:16:34
|
Hi Christoph
On 06/03/13 09:47, Christoph Bersch wrote:
> Am 05.03.2013 22:04, schrieb Sylwester Arabas:
>> The problem is that both 21:55:23.svg and 21:55:26.svg include the same
>> gp_image_01.png file, while the plotted data could in principle be
>> different in the two svg files. Changing the prefix of the png file from
>> gp_image_ to something like 21:55:23.svg_image_ would fix the problem.
>
> you can use the 'name' option of the svg terminal:
Thanks a lot!
Perhaps it's worth discussing it in the help section in term/svg.trm.
Also, why not make it a default behaviour? It's quite tricky to find out
why you get same plots with different data :)
> I replaced the : by _ in the filename, because 'name' takes only
> alphanumeric characters and _. (Don't know why)
While gnuplot does warn about e.g. a dot in the value of "name", it in
fact proceeds with creating the file correctly!:
gnuplot> filename = 'figure_pc_tht_0.svg'
gnuplot> set term svg dynamic name filename
Terminal type set to 'svg'
^
name must contain only alphanumerics or _
...
gnuplot> !ls *.png
...
figure_pc_tht_0.svg_image_03.png
...
Best,
Sylwester
--
http://www.igf.fuw.edu.pl/~slayoo/
|
|
From: Christoph B. <us...@be...> - 2013-03-06 10:59:01
|
Hi, Am 06.03.2013 11:16, schrieb Sylwester Arabas: > > Also, why not make it a default behaviour? It's quite tricky to find out > why you get same plots with different data :) the 'name' parameter is primarily used to name the plots in a svg file. If one would make this default behaviour (like it is done e.g. in lua terminal), one must also take care to encode the URI of the image file in the xlink:href part properly. > > > I replaced the : by _ in the filename, because 'name' takes only > > alphanumeric characters and _. (Don't know why) > > While gnuplot does warn about e.g. a dot in the value of "name", it in > fact proceeds with creating the file correctly!: For me it does not (4.6.0 and CVS). Best regards, Christoph |
|
From: Sylwester A. <sa...@ig...> - 2013-03-06 11:10:17
|
Hi, On 06/03/13 11:51, Christoph Bersch wrote: > Am 06.03.2013 11:16, schrieb Sylwester Arabas: >> Also, why not make it a default behaviour? It's quite tricky to find out >> why you get same plots with different data :) > > the 'name' parameter is primarily used to name the plots in a svg file. > > If one would make this default behaviour (like it is done e.g. in lua > terminal), one must also take care to encode the URI of the image file > in the xlink:href part properly. Then maybe issuing a warning before overwriting an existing png file would be a solution? >> > I replaced the : by _ in the filename, because 'name' takes only >> > alphanumeric characters and _. (Don't know why) >> >> While gnuplot does warn about e.g. a dot in the value of "name", it in >> fact proceeds with creating the file correctly!: > > For me it does not (4.6.0 and CVS). I'm using 4.6 patchlevel 0 from the Debian 4.6.0-8 package. Best regards, Sylwester -- http://www.igf.fuw.edu.pl/~slayoo/ |
|
From: Mojca M. <moj...@gm...> - 2013-03-06 14:22:56
|
On Wed, Mar 6, 2013 at 12:10 PM, Sylwester Arabas wrote: > > Then maybe issuing a warning before overwriting an existing png file > would be a solution? This would be problematic. Many people simply run the same plotting commands/scripts multiple times (either during development/improvement of graphs or to display measurement results for different data), *expecting* the files to be overwritten. I'm not using SVG, but for any format that I'm using, I would be annoyed if I would have to confirm overwriting files. Mojca |
|
From: Jonathan T. <jt...@as...> - 2013-03-09 20:26:37
|
On Wed, 6 Mar 2013, Mojca Miklavec wrote:
> This would be problematic. Many people simply run the same plotting
> commands/scripts multiple times (either during development/improvement
> of graphs or to display measurement results for different data),
> *expecting* the files to be overwritten. I'm not using SVG, but for
> any format that I'm using, I would be annoyed if I would have to
> confirm overwriting files.
*Very* emphatic agreement!
--
-- "Jonathan Thornburg [remove -animal to reply]" <jt...@as...-zebra.e$
Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
on sabbatical in Canada starting August 2012
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
|
|
From: <pl...@pi...> - 2013-03-06 17:04:20
|
On 03/06/13 15:22, Mojca Miklavec wrote: > On Wed, Mar 6, 2013 at 12:10 PM, Sylwester Arabas wrote: >> >> Then maybe issuing a warning before overwriting an existing png file >> would be a solution? > > This would be problematic. Many people simply run the same plotting > commands/scripts multiple times (either during development/improvement > of graphs or to display measurement results for different data), > *expecting* the files to be overwritten. I'm not using SVG, but for > any format that I'm using, I would be annoyed if I would have to > confirm overwriting files. > > Mojca > Agreed. No "are you sure" for God's sake. and... yes I am sure that I'm sure that I don't want to be asked. :) |
|
From: Sylwester A. <sa...@ig...> - 2013-03-06 23:50:44
|
Hi, On 06/03/13 16:51, pl...@pi... wrote: > On 03/06/13 15:22, Mojca Miklavec wrote: >> On Wed, Mar 6, 2013 at 12:10 PM, Sylwester Arabas wrote: >>> >>> Then maybe issuing a warning before overwriting an existing png file >>> would be a solution? >> >> This would be problematic. Many people simply run the same plotting >> commands/scripts multiple times (either during development/improvement >> of graphs or to display measurement results for different data), >> *expecting* the files to be overwritten. I'm not using SVG, but for >> any format that I'm using, I would be annoyed if I would have to >> confirm overwriting files. Wouldn't you be annoyed if you "simply run the same plotting commands/scripts multiple times" with different data and different output file specified, but get the data from just the last plot in all of the output files? :) $ cat full.gpi set term svg set palette negative set view map set output "full.svg" splot '-' matrix with image notitle 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 e $ cat half.gpi set term svg set palette negative set view map set output "half.svg" splot '-' matrix with image notitle 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 e $ gnuplot full.gpi $ gnuplot half.gpi Now both full.svg and half.svg contain the same image (half) even though the input data was different, and the output file was different! Basically, anything you plot with "splot with image" on an svg terminal silently damages all svg files in the current directory previously plotted "with image". Unfair. HTH, Sylwester P.S. Is there any way to force gnuplot not to use external png files but instead draw the images pixel-by-pixel with svg rectangles as it was done in older versions of gnuplot? -- http://www.igf.fuw.edu.pl/~slayoo/ |
|
From: Daniel J S. <dan...@ie...> - 2013-03-07 06:03:22
|
On 03/06/2013 05:50 PM, Sylwester Arabas wrote: > HTH, > Sylwester > > P.S. Is there any way to force gnuplot not to use external png files but > instead draw the images pixel-by-pixel with svg rectangles as it was > done in older versions of gnuplot? There may be something similar to what you are looking for, Sylwester. Browse these demos: http://gnuplot.sourceforge.net/demo_4.6/pm3d.html Dan |
|
From: sfeam (E. Merritt) <eam...@gm...> - 2013-03-07 05:29:18
|
On Wednesday, 06 March 2013, Sylwester Arabas wrote: > Hi, > > On 06/03/13 16:51, pl...@pi... wrote: > > On 03/06/13 15:22, Mojca Miklavec wrote: > >> On Wed, Mar 6, 2013 at 12:10 PM, Sylwester Arabas wrote: > >>> > >>> Then maybe issuing a warning before overwriting an existing png file > >>> would be a solution? > >> > >> This would be problematic. Many people simply run the same plotting > >> commands/scripts multiple times (either during development/improvement > >> of graphs or to display measurement results for different data), > >> *expecting* the files to be overwritten. I'm not using SVG, but for > >> any format that I'm using, I would be annoyed if I would have to > >> confirm overwriting files. > > Wouldn't you be annoyed if you "simply run the same plotting > commands/scripts multiple times" with different data and different > output file specified, but get the data from just the last plot in all > of the output files? :) Your complaint about incomplete documentation is reasonable. The svg terminal should give an explanation for the 'name' option similar to the one given by the canvas terminal. > Basically, anything you plot with "splot with image" on an svg terminal > silently damages all svg files in the current directory previously > plotted "with image". Unfair. Not really. You just have to give a unique name to each plot. See, for example, the image demo: http://gnuplot.sourceforge.net/demo_svg_4.7/image.html > P.S. Is there any way to force gnuplot not to use external png files but > instead draw the images pixel-by-pixel with svg rectangles as it was > done in older versions of gnuplot? Yes. plot 'foo' with image failsafe |
|
From: Daniel J S. <dan...@ie...> - 2013-03-07 06:03:05
|
On 03/06/2013 11:29 PM, sfeam (Ethan Merritt) wrote: > On Wednesday, 06 March 2013, Sylwester Arabas wrote: >> P.S. Is there any way to force gnuplot not to use external png files but >> instead draw the images pixel-by-pixel with svg rectangles as it was >> done in older versions of gnuplot? > > Yes. > plot 'foo' with image failsafe I forgot about that. Similar end result, easier syntax. Dan |
|
From: Sylwester A. <sa...@ig...> - 2013-03-07 08:33:02
|
Dear All, On 07/03/13 06:46, Daniel J Sebald wrote: > On 03/06/2013 11:29 PM, sfeam (Ethan Merritt) wrote: >> On Wednesday, 06 March 2013, Sylwester Arabas wrote: > >>> P.S. Is there any way to force gnuplot not to use external png files but >>> instead draw the images pixel-by-pixel with svg rectangles as it was >>> done in older versions of gnuplot? >> >> Yes. >> plot 'foo' with image failsafe Thanks! Best, Sylwester -- http://www.igf.fuw.edu.pl/~slayoo/ |