Description of problem: The following test file generates invalid svg output. Specifically, there is an unmatched "</g>" tag in the second line from the end. $ cat test-svg-output-2.g # # test-svg-output-2.g # set terminal svg set output 'test-svg-output-2.svg' plot x replot 2*x Version-Release number of selected component (if applicable): gnuplot-4.6.1-4.fc18.x86_64 eog-3.6.2-1.fc18.x86_64 inkscape-0.48.4-1.fc18.x86_64 How reproducible: Always. Steps to Reproduce: 1. $ gnuplot test-svg-output-2.g 2. $ eog test-svg-output-2.svg 3. $ inkscape test-svg-output-2.svg Actual results: Both eog and inkscape report errors and do not display the plot: $ eog test-svg-output-2.svg (eog:4850): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Error domain 1 code 76 on line 174 column 5 of file:///home/XXX/test-svg-output-2.svg: Opening and ending tag mismatch: svg line 0 and g (eog:4850): EOG-CRITICAL **: eog_list_store_length: assertion `EOG_IS_LIST_STORE (store)' failed $ inkscape test-svg-output-2.svg /home/XXX/test-svg-output-2.svg:174: parser error : Opening and ending tag mismatch: svg line 4 and g </g> ^ /home/stephent/src/exp/gnuplot/test-svg-output-2.svg:175: parser error : Extra content at the end of the document </svg> Expected results: Plot is displayed without errors. Additional info:
Created attachment 762637 [details] test-svg-output-2.g test file
Created attachment 762638 [details] test-svg-output-2.svg invalid svg file
Created attachment 762639 [details] test-svg-output-2.svg.PATCHED Both eog and inkscape display this patched file as expected: $ diff -u test-svg-output-2.svg test-svg-output-2.svg.PATCHED --- test-svg-output-2.svg 2013-06-18 13:05:27.367037519 -0700 +++ test-svg-output-2.svg.PATCHED 2013-06-18 13:44:55.701392245 -0700 @@ -171,6 +171,7 @@ </g> <g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter"> <path d='M45.6,16.7 L45.6,444.0 L575.0,444.0 L575.0,16.7 L45.6,16.7 Z h0.01'/></g> +<g> </g> </svg>
Created attachment 764374 [details] w3c-svg-validation-errors-1.txt The gnuplot svg output also fails the W3C SVG validation test: http://validator.w3.org/ ... Error Line 134, Column 9: ID "gnuplot_plot_1" already defined ... Error Line 174, Column 4: end tag for element "g" which is not open ...
https://sourceforge.net/p/gnuplot/bugs/1298/
To quote Ethan Merritt: "Confirmed. The breakage seems to have occurred between 4.4.4 and 4.6.0. On the other hand, this sequence of commands makes little sense for svg output. Unlike page-oriented formats (PostScript, PDF) or interactive displays that allow sequential inspection of plots (x11, wxt, qt), svg documents are not intended to hold more than one full-page display element. Even if the number of \<g>/\</g> pairings were correct, the 2 plots would lie on top of each other. The normal sequence would be to either reopen the output svg file (new "set output" command) before the "replot", or wrap both the 1st and 2nd plots in a multiplot sequence: set multiplot layout 2,1 plot x replot unset multiplot So while I agree than producing a corrupt document is not helpful, fixing that will only reveal an underlying problem in the command sequence that produced it." These solutions work in Fedora. Or maybe multiplot layout 1,1 instead of 2,1 if that is what you want to achieve.