Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.


Layout gets skewed immediately after exporting as an SVG file

0 votes

This has only started happening in the last two months.  I've been using yEd for years and not seen this happen before.

I have a diagram laid out in hierarchical bottom to top format, and it looks well and straight.  Then I export it as an SVG.  The moment the SVG file is created the contents of the diagram are now skewed to the right for some unknown reason.  When I look at the SVG file it's also skewed in it too.

It only happens with SVG and compressed SVG's.  Not with PNG's.

Before SVG export (anonymized):


After SVG export (anonymized):


in Help by (870 points)

Since this happens for an anonymized version of your graph, would it be possible for you to upload a GraphML file of that anonymized version for testing purposes?
Please see How to upload files to yEd Q&A? for instructions on uploading files.

Additionally, please upload the settings.xml file from the yEd profile directory as well.
Please see "Help" -> "About" for the profile directory location.

Please do provide some additional information as well:
Which version of yEd are you using?
On which operating system are you using yEd?
Which version of Java are you using (see "Help" -> "About")?

That said, your "After SVG export" image shows that the width of the nodes connected to the skewed edges has been increased. Increasing a node's width (or height) will proportionally move edge connection points. While this explains why your edges are now skewed, it is still unclear which operation increased the size of your nodes in the first place. It looks like the label texts of your closed group nodes were edited with "Dynamically Adjust Node Size to Label Size" enabled, but SVG export does not change label texts and thus does not trigger dynamic adjustments.

I anonymized both diagrams before and after.  The actual document isn't an anonymized document.  I just can't share the material as is as it's sensitive.
Version 3.22 Powered by the yFiles Graph Visualization Library http://www.yWorks.com Copyright 2000-2022 yWorks GmbH. All Rights Reserved.  Java Version: 15.0.2 Java VM: OpenJDK 64-Bit Server VM, Oracle Corporation
Interestingly, if I export the anonymized version the issue doesn't happen.
Also, yEd doesn't see that shifting to the right as an action in the undo history, meaning I cannot undo it, I have to re apply the layout algorithm.
I've tried deleting my %APPDATA%/yWorks/yEd directory and starting fresh, opening the document and exporting and the issue is still there.

Before that I tried disabling dynamic adjust node size to label size but that didn't work either.
I've also tried installing yEd on a fresh system and exporting the same document as SVG - same issue there too.


I anonymized both diagrams before and after.  The actual document isn't an anonymized document.

Did you anonymize your diagram manually? In this case, I would like to point you to "Tools" -> "Anonymize". Said tool creates a new editor tab with an anonymized copy of your diagram.

Would it be possible for you to copy the two nodes and the one edge I marked in the image below from your original diagram into a new diagram, then replace any texts with non-sensical text (but do not remove the text completely), save the copied three-elements diagram to GraphML, and send that GraphML? The GraphML file would then contain the styles and their configurations for further investigation without having any sensitive information.

I can't see any option to upload a file and the image uploader only takes standard image filetypes, so I've pasted the Graphml XML of the new document with the two nodes and the one edge in it. Hopefully it gets through in one piece.

Sample GraphML

Thank you very much for the sample GraphML.


I can't see any option to upload a file [...]

Please see the upload instructions in my very first comment.

Your original diagram is stored as GraphML, right?

When you open your original diagram and select all group nodes, does this trigger the resizing already?

If not, does the resizing still happen if you turn off "Consider Label" in the "Open Group" property section and after that export to SVG?

One possible cause for the strange resizing could be inconsistent label sizes. The "Consider Label" option forces group nodes to grow in width to be wide enough to contain their label and their state icon. For this to work, yEd has to calculate the size of the group node labels. If the size calculation now returns larger values than at the time you created the diagram, your labels will "grow" and consequently your nodes will grow.

Label size calculation depends on operating system text measuring as well as Java text measuring. Thus any change to your machine or to yEd that affects text measuring might result in the undesired resize effect you are experiencing. E.g. if you work on different operating systems, text measuring will differ. A system update that affects fonts might change text measuring. Changing the Java version on which yEd runs might change text measuring.

Unfortunately, there is one thing that does not fit the "text measuring changed" theory: if text measuring did indeed change and your labels do grow in response to the changed measuring, the undesired growth should happen right when your diagram is first displayed.
I cannot think of a reason why this would happen only after SVG export.

You could try to verify the "text measuring changed" theory using the following approach:

  1. Start yEd.
  2. Open an empty document.
  3. In a second tab, open your original diagram.
  4. In the original diagram, find a group node that is connected to one of the skewed edges.
  5. In the empty document, create an empty group node with the same style and style configuration as the group node from step 4.
  6. Edit the label of the new group node and set to the same text as the the group node from step 4.
  7. Save the new document as a GraphML file.
  8. Open the GraphML file of your original diagram and the GraphML file of the new diagram in a text editor.
  9. In both files, find the <y:NodeLabel ...>...</y:NodeLabel> element that encloses the text from step 6.
  10. Compare the values of the width attributes of the elements from step 7.
Fixed!  I selected all group nodes and observed that I had mixed states for the "Consider Label" option in the "Open Group" tab.  I deselected it for all group nodes and then attempted an SVG export.  The problem went away and no resizing occurred!  Many thanks for your help on this Thomas.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Legal Disclosure | Privacy Policy