1

I do scientific drawings and I often need to import curves from pyplot with an svg format.

But when I stretch then too heavily, here is what happens:

Yet, what I would like is a stroke that stays even, no matter how much you rescale it. This issue have been here for years and never corrected, and I was never able to find a procedure that removes this thing without fail. Could anyone tell me a procedure to remove this think for sure, or the position in the xml file of the option that does this ? I included below the code of an svg file showing the problem as an example.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="38.289249mm"
   height="179.07323mm"
   viewBox="0 0 38.28925 179.07325"
   version="1.1"
   id="svg6539"
   inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
   sodipodi:docname="MWEs - Copie.svg">
  <defs
     id="defs6533">
    <clipPath
       id="pcbefdf05c9">
      <rect
         height="326.16"
         width="558"
         x="90"
         y="51.84"
         id="rect417" />
    </clipPath>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.9899495"
     inkscape:cx="203.88158"
     inkscape:cy="346.31362"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     showgrid="false"
     showguides="false"
     fit-margin-top="10"
     fit-margin-left="10"
     fit-margin-right="10"
     fit-margin-bottom="10"
     inkscape:window-width="1920"
     inkscape:window-height="986"
     inkscape:window-x="-11"
     inkscape:window-y="-11"
     inkscape:window-maximized="1"
     inkscape:snap-global="true"
     inkscape:snap-bbox="true"
     inkscape:bbox-paths="true"
     inkscape:bbox-nodes="true"
     inkscape:snap-bbox-edge-midpoints="true"
     inkscape:snap-bbox-midpoints="true"
     inkscape:object-paths="true"
     inkscape:snap-intersection-paths="true"
     inkscape:snap-smooth-nodes="true"
     inkscape:snap-midpoints="true"
     inkscape:snap-object-midpoints="true"
     inkscape:snap-center="true"
     inkscape:snap-text-baseline="true"
     inkscape:snap-page="true" />
  <metadata
     id="metadata6536">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Calque 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(125.14134,60.95706)">
    <path
       style="fill:none;stroke:#1f77b4;stroke-width:33.15565872;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
       clip-path="none"
       d="m 622.63636,66.665452 c -67.77884,0.239241 -135.57687,0.06619 -203.3364,1.917431 -76.17193,4.056124 -165.2995,1.147605 -222.44225,60.613027 -55.74299,64.2052 -69.76372,152.5374 -81.49407,233.97864"
       id="path4850"
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="cccc"
       transform="matrix(0.03492049,0,0,0.50427365,-118.5969,-76.21498)" />
  </g>
</svg>
3

There is a setting to disable scaling stroke width as the object is scaled.

UI button to control scaling of stroke

Uncheck this button, and the stroke will keep its width regardless of scaling. The other 3 buttons control scaling of rounded corners, gradients and bitmaps.

5
  • This unfortunatly does not solve the issue. You still end up having distorted lines.
    – HcN
    Feb 28 '20 at 14:29
  • 2
    For the answer, I tested with your supplied SVG: undid the transform to obtain the original path, then scaled it for verification. Maybe the original SVG file could help.
    – Juancho
    Feb 28 '20 at 14:35
  • How did you "undo" the transformation ?
    – HcN
    Feb 28 '20 at 14:39
  • @HcN, check this answer on un-doing transformations.
    – Juancho
    Feb 28 '20 at 15:14
  • @HcN I think this answer will solve your issue, but you need to choose the options shown BEFORE you do any scaling or stretching in Inkscape, not afterwards. Then you won't have to worry about undoing anything.
    – Billy Kerr
    Feb 28 '20 at 15:28
1

As Juancho pointed out, the unevenness is caused by a transform attribute on the path.

You can avoid adding unnecessary transforms by:

  • not stretching groups, but only their contents
  • by making sure to check the option Edit > Preferences > Behavior > Transforms: Store transformation: optimized

If you load such a file, and have that preferences setting activated, remove the transform by 'nudging' the path, up a bit with the arrow keys and down again by the same amount.

You can also try how far this extension gets you: https://inkscape.org/~Klowner/%E2%98%85apply-transforms

0

I still have no idea what is going on, but I got something that worked on my home computer but doen not on my work computer (Both Windows 10 running Inkscape v.0.92.4) :

– Remove any clipped object. It is the case by default from .svg pictures obtained from pyplot

– Select the curve and only the curve, type "group" then "ungroup" (maybe several times each).

Than removed the uneven path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.