Categories


Archives


Recent Posts


Categories


Aligning .dot Labels

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Over the past few years I’ve been making heavy use of DOT, the Directed Graph programming language, using GraphViz for output. It’s basically a text format for building flowchart like diagrams (i.e. directed graphs). It’s a classic computer science thing; “Very Smart, Very Obtuse Syntax”.

I’d been running into a problem where I couldn’t get me labels to correctly left or right align. They’d always appear to align center. Even when I discovered there are three newline characters

  1. \n Newline, align center
  2. \l Newline, align left
  3. \r Newline, align right

I’d still get what looked like centered output. It turns out that, in dot, each line of a label can have a different alignment. So, adding a final \l to my labels fixed things.

NODE [
    label="This is a test \lof creating my lines\lin a non-centeredway\l"
]

I pass this into the internet group mind in the hope it saves someone else some time.

Originally published June 29, 2009

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 29th June 2009

email hidden; JavaScript is required