bugGNU Octave - Bugs: bug #34146, svg output does not scale

 
 

bug #34146: svg output does not scale

Submitter:  None
Submitted:  Sat 27 Aug 2011 07:54:41 AM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Works For Me Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  3.4.0
Operating System:  GNU/Linux Fixed Release:  None
Planned Release:  None

Discussion locked!

Jump to the original submission

Wed 31 Aug 2011 06:48:43 PM UTC, comment #9: 

I have confirmed that gnuplot has changed the way SVG is output. The code snippet below is from their developer's cvs.


    if (SVG_fixed_size)
        fprintf (gpoutfile, "\n width=\"%u\" height=\"%u\" ",
                 (unsigned int) (term->xmax / SVG_SCALE),
                 (unsigned int) (term->ymax / SVG_SCALE));

    fprintf (gpoutfile, "\n viewBox=\"0 0 %u %u\"\n",
             (unsigned int) (term->xmax / SVG_SCALE),
             (unsigned int) (term->ymax / SVG_SCALE));


The current sources should produce an unscaled version by default. Ironically, the manual for the 4.4 series indicates that unscaled is the default, but gnuplot produces a scalable version, none the less.

In any event, the sources can be modified to ensure the output is scalable for gnuplot.

As we'd like the OpenGL output to be consistent, I'll check with the glps developers to see what can be done there.

Ben Abbott <bpabbott>
Group Member
Wed 31 Aug 2011 04:22:19 PM UTC, comment #8: 

If you are convinced there is a bug with gnuplot svg output, I suggest you report the bug to gnuplot.

Ben Abbott <bpabbott>
Group Member
Wed 31 Aug 2011 04:13:54 PM UTC, comment #7: 

I did check your attachment out and it DOES NOT scale on the viewers I indicated. You have not replied to my question as to what viewer(s) you had tested on, so I'll have to guess from the mac.com addresses that you only used Safari. I reiterate your need to do further testing.

My gnuplot does not produce h,w when used via octave THAT is the bug I reported. Using gnuplot directly does . If I don't supply those parameters it uses a default and put THAT value in the output:(and it's output does scale)


gnuplot> set terminal svg
Terminal type set to 'svg'
Options are 'size 600,480 fixed  fname 'Arial'  fsize 12 butt solid '
gnuplot> set output 'svg-size-test.svg'


This produces a file starting as follows.


<?xml version="1.0" encoding="utf-8"  standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
 width="600" height="480"
 viewBox="0 0 600 480"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"

>


<desc>Produced by GNUPLOT 4.5 patchlevel 0 </desc>


I hope that helps you confirm the bug.

Anonymous
Wed 31 Aug 2011 04:11:43 PM UTC, comment #6: 

Octave is not a commercial program--it is maintained by solely by volunteers.  We are not your personal developers unless you agree to pay us.  We have confirmed that it works on two different operating systems (Mac OS and Linux) and two different versions of gnuplot (4.4.3 and 4.2.6) and I have tried it on two different versions of Octave (3.4.0 and 3.4.2).  I would suggest you try a true svg editor, such as Inkscape, rather than a browser to truly determine whether the generated svg is scalable.

Rik <rik5>
Group administrator
Wed 31 Aug 2011 01:58:28 PM UTC, comment #5: 

Its been a while since I was familar with SVG file format, but I'm rather confident that the line below means the graphic is scalable.

<svg viewBox="0 0 576 452">

But this one is not.

<svg width="576px" height="452px" viewBox="0 0 576 452">

To be clear the svg produced by my gnuplot does not include the width/height attributes.

In my prior comment, I indicated that I'd attached an example produced using the gnuplot backend. Please take a look.

I'm running gnuplot 4.4 patchlevel 3. What version of gnuplot are you running?

Ben Abbott <bpabbott>
Group Member
Wed 31 Aug 2011 01:13:24 PM UTC, comment #4: 

checkout what viewBox means ;)

you need h,w as well.

Anonymous
Wed 31 Aug 2011 12:39:17 PM UTC, comment #3: 

What are use using to view this "works for me" ?

I have tested with firefox and opera. The latter has a note in the status bar that shows the "zoom" is increasing is I supposedly zoom in but the image stays the same display size.

I have indicated there is a problem , if it "works for you" then maybe you need to do more thorough testing.

Anonymous
Wed 31 Aug 2011 05:10:17 AM UTC, comment #2: 

I plotted sombrero() and scaling works for me as well.

Rik <rik5>
Group administrator
Wed 31 Aug 2011 01:48:43 AM UTC, comment #1: 

I did a simple test using the developer's sources.


close all
graphics_tookit gnuplot
surf (peaks ())
print gnuplot.svg


I've attached the result. It scales for me.




(file #23911)

Ben Abbott <bpabbott>
Group Member
Sat 27 Aug 2011 07:54:41 AM UTC, original submission:  

using print() with -dsvg produces a non-scalable svg.

since the "s" in svg stands for "scalable" it rather seems to defeat the main purpose of this format to produce non scalable output.

looking at the first few lines shows :

<svg
viewBox="0 0 576 432"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"



Looking at other svg files created with gnuplot I see the first line contains height and width:

<svg  width="600" height="480" viewBox="0 0 600 480"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink">


Since having a non-scalable "scalable" graphic is probably not what is most useful I assume this is an error.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #23911:  gnuplot.svg added by bpabbott (633KiB - image/svg+xml)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by bpabbott (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-01-10 jordigh Dependencies- bugs #35270 is dependent
    2011-08-31 rik5 Discussion LockNone Locked
    2011-08-31 rik5 Open/ClosedOpen Closed
    2011-08-31 bpabbott Attached File- Added gnuplot.svg, #23911
        StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code