Re: Gnuplot generates invalid SVG?



In article <690b2765-9c8f-48b9-bcdd-c892e545fb16@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<googoff@xxxxxxxxxxx> wrote:
On Jul 28, 11:10=A0pm, merr...@xxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
In article <6f6q2cFa4fi...@xxxxxxxxxxxxxxxxxx>,
Michael Schmarck =A0<michael.schma...@xxxxxxxxxxxx> wrote:

=B7 merr...@xxxxxxxxxxxxxxxxxxxxxxxxxxx <merr...@xxxxxxxxxxxxxxxxxxxxxxx=
.edu>:

Possibly you copied or saved the file before gnuplot was finished
writing it.

Well, sort of - I copied it, after I ran the commands I posted
in interactive mode. You'll notice, that there's no "quit" command
in the list of commands I posted.

After sending "quit" (or exit or ^d), the file has the </svg>
line.

What's the command that makes gnuplot "close" the file? Is it
=A0 =A0 =A0 =A0set output

Either 'set output' or 'unset output' will force the current file
to be written and closed. =A0This is necessary because some output
types (e.g. postscript) allow multiple plots in the same file, so
gnuplot cannot close the output file until instructed that no more
plots are coming. =A0In the case of svg output, possibly it could be
smarter about writing the </svg> even in advance of closing the file.

--
Ethan A Merritt

Hi Ethan,

could some thourght be given to this? It ties in with what I have seen
using replot in svg. Basically the whole file gets duped.

I don't really see how to make gnuplot smart enough to detect whether
you really want to add more to the existing plot or whether you want to
throw it away and create another one instead.

How do you suggest we could solve this basic problem?

IIRC what I was doing was defining a label (like a max x value or
something) as a result of plotting my data then using replot to get
the same graph with the label.

If this is done in png or similar bitmapped image there is repetition
of the plot command but the output just gets overwritten.

Not if you are streaming the output. You get a 2nd complete plot in
the output stream. This is, in fact, extremely useful. You can leave
the stream open on a viewer and see the successive plots as they are
created. If you tried to close the file each time, it would break the
connection to the viewer.

In the case of svg the file doubles in size and I get two versions of
the label superimposed with different strings, dependant on the input
data.

Should replot implicitly close and reopen ? Is there a circumstance
where replot would intentionally superimpose, and how would this
compare to other formats?

Sure:

set multiplot layout 2,2 title "Gradually more complex graph"
plot 'foo'
replot 'baz'
replot 'third'
replot 'allatonce'
unset multiplot

That will generate four non-overlapping graphs on the output page.
They will respectively contain 1, 2, 3, or 4 separate curves.
I wouldn't do it that way, myself, but some people do use replot for
that kind of thing.

Since all axes and labels are determined before plot it seems like
replot should close and reopen , in which case the anticipated </svg>
could be sent at the end of plot.

Sorry, I don't follow you here. The labels are known, yes, but the
axes are not detemined until the data is read in and evaluated.
Anyhow, what how does this relate to the issue of whether the previous
plot is to be discarded or saved?

At first sight this would seem to give output more consistant with
other terminal types and like you say, smarter svg closing.

Can you see a circumstance where this would not give correct output?

The obvious case is when you really do want more than one graph
on the same page. How would you accomplish that if the file is closed
automatically after the first one?

I don't say it's impossible to get this right, but so far I don't
see an obvious way to decide whether or not to close and reopen the file.


--
Ethan A Merritt
.



Relevant Pages

  • Re: Gnuplot generates invalid SVG?
    ... using replot in svg. ... the same graph with the label. ... of the plot command but the output just gets overwritten. ... Since all axes and labels are determined before plot it seems like ...
    (comp.graphics.apps.gnuplot)
  • skipping data file no valid points
    ... Then I enter my command to plot ... skipping data file and the resultant graph is incomplete. ... I create a new data file, copying only column 1, column 4, column 5, ... I plot these columns successfully, with the plot commands columns 1 ...
    (comp.graphics.apps.gnuplot)
  • 3d Plotting in Time problem.
    ... I am trying to plot some data in time where I have ... command works perfectly but when I try to assign a time to ... The graph becomes highly distorted and unreadable. ... graph, the x axis has become so fine, you cannot see anything: ...
    (comp.soft-sys.matlab)
  • Re: replot - : e does not terminate command
    ... I am trying to use replot to add curves to my plot. ... gnuplot> replot '-' ... Notice that the first e did not terminate the command. ...
    (comp.graphics.apps.gnuplot)
  • Re: Functionality similar to Scilabs subplot()
    ... Multiplot displays them nicely, BUT only allows zooming on the latest plot. ... Gnuplot is using "replot" after the ... the last graph only, you will get just that one last graph. ...
    (comp.graphics.apps.gnuplot)