Using Dia for diagrams

Using Dia for diagrams


Everybody needs diagrams. Most users need to create one more often than they think: that flowchart for a presentation, that sketch of the bird feeder to build this weekend, or a time line. Getting more technical, there are always circuits and blueprints and the like. Stop wasting time with an office app, the GIMP, or a paint program: use Dia, an easy yet powerful made-for-diagrams editor.

Getting Dia

If you're running GNU/Linux, then just snag Dia from your distribution's repositories. If you're using Windows, then it's more complicated: your best bet is following these instructions to install Dia on Windows. Open Dia up, and--well, nothing fantastic happens. Just like most programs, you'll see a canvas, a toolbox, and a toolbar to open, save, copy, get help, etc. The canvas has pretty little squares, to check the scale and orientation of things you draw. The toolbox might seem a bit different. Even still, it really doesn't seem to be quite enough.

Let's explore what you can do with it.

Dia when you first open itDia when you first open it

Getting started

I already mentioned the canvas. If you've ever used Paint, Powerpoint, OpenOffice Impress, the GIMP, or any similar program (and I'm sure you have), you'll know exactly what to do: you draw stuff on it. To decide what you want to draw you use the toolbox, which is the window with all the icons in it. Make a line: click the "line" icon in the toolbox (it looks like a backslash with a dot at each end), click on the canvas, and drag somewhere else on the canvas.

If you don't like the way it looks, grab one of the ends of it (with the yellow square), and click and drag to resize it. I told you this was easy!

The different parts of DiaThe different parts of Dia

This line is straight, with nothing special at the end, and it's pretty much boring. (If you have an arrow at the end of your line, don't worry, this will make sense anyway.) So, suppose you want it to be more interesting: at the bottom of the toolbox there are three wider icons, with three straight lines in them. They stand for the beginning, middle, and end of the line. Click on one, and change it to an arrow (if it was already an arrow, change it to something else). Make a new line, and then change the middle and right icons. Make another line. See the pattern? It's not about left and right, it's about start and finish.

To make a rectangle, you could draw four lines; however, that's tedious at best, and inaccurate at worst. Conveniently, Dia has a rectangle tool. It looks like a rectangle, right above the line tool. Try drawing a rectangle on the canvas.

Now be brave, and draw an ellipse.

Dia after some fun with the toolboxDia after some fun with the toolbox

Note that the rectangle and ellipse have the same line style as the one you picked for the line. If you don't like it, change it the same way you changed the lines.

Play around with all the other tools in your toolbox. Hovering over the icon will say what it does, if you're confused.

Getting advanced

If you try to make polygons with the polygon button, you might get a bit thrown -- you might be wondering how to make anything other than triangles!

If you want to make interesting polygons, right click your polygon, and select "Add Corner." Now you have an extra point to play with, and your polygon just turned into a quadrilateral. Do it again, and you will get a pentagon. Do it 138 times, and--whoever's close by will laugh at you!

Adding a corner to a polygonAdding a corner to a polygon

The right-click menu has a few more tricks up its sleeve. Right click a shape/line again and hit "Properties". Now you can play with the width and color and more (the color is in hex format, which is outside the scope of this article. Read about it in this tutorial about hex notation).

The The "Properties" menu

For ellipses and rectangles, the menu has even more options: "Fixed aspect" and "Circle" (or "Square"). Remember that "fixed aspect" just means the proportions are the same when you change the size, and doesn't guarantee the squareness of it.

The menu of object sheetsThe menu of object sheets

The last "advanced: creating objects. In Dia's lingo, "object" means "a predefined bunch of lines that means something specific". So in your toolbox, look at the spot that says "Misc". Now look below it: you'll see a clock, a folder, etc. Make a clock just like you would with anything else: click and drag. Try a folder too.

You might be wondering why Dia offers an "folder" object to draw... which brings up the entire point of objects. They're meant to be extensions of Dia for different (more specialized) tasks. "Misc" could be useful for making a diagram of a filesystem. Click "Misc", then "Other sheets", and you'll see a menu of a lot of possible objects. Try "Flowchart." Suddenly, you have a lot of handy flowchart objects.

Five-minute flowchartFive-minute flowchart

Conclusion

Now you know enough about Dia to get a lot of tasks done. It's pretty intuitive to start, and just playing with it for a few minutes makes it even more so. However, there's still a lot you could learn which I haven't even touched on.

One thing is that Dia supports Python scripts. That is definitely outside the scope of this article, but there's a nifty guide on how to use Python with Dia. Speaking about guides, have a look at Dia's official tutorial.

To get better, the best step is to stop reading this article and play with Dia. Enjoy!

Category: 
Tagging: 
License: 

Comments

jtappin's picture
Submitted by jtappin on

While I've only had a quick look at dia, it doesn't really look to offer as much capability as the granddaddy of all drawing tools -- xfig.

mjjzf's picture
Submitted by mjjzf on

I agree. It is ugly as sin, but it works - and Dia is not noticeably easier to use (which would be the selling argument) than Xfig.
__
FSF member no. 6426

Golodh's picture
Submitted by Golodh on

Well, XFig is a drawing package first, and yes, you can also use it to draw diagrams. Dia on the other hand is a specialised package for drawing diagrams.

Dia has two advantages over Xfig when it comes to diagrams

1) Dia is multi-platform, and not just Linux-based. Well, an enterprising soul may be able to get XFig to work under Windows but it's not worth it, IMO, since Dia does what you need for diagrams. And for general-purpose work I'd generally prefer the Gimp.

2) Dia, being an object-oriented vector drawing package, redraws the connectors when you move the diagram boxes about. Xfig, being just a drawing package, doesn't. This is fairly basic and indispensible functionality when drawing large diagrams (unless you already know what the diagram looks like and only need a tool to draw it).

Dia also has disadvantages. The worst one being that it (in version 0.96.1) crashed a few times when I used it to draw (fairly large) diagrams. Poof ... diagram gone. That behaviour one might tolerate in beta software, but not in a release version. It gives OSS software a poor name.

As the Dia website says, Dia is basically a knock-off from Visio. That's not something to be ashamed of though. Dia is great for those who don't need the quality and functionality of Visio (or who don't wish to pay its hefty price), and who are willing to save every five minutes or so.

jtienhaara's picture
Submitted by jtienhaara on

Nice intro to Dia, Timmy!

I used to be an xfig devotee, and refused to switch to anything for UML diagrams until Dia came along.

I have since tried everything under the sun and no free/open source drawing program comes anywhere close to Dia IMHO for power & ease of use; and many commercial applications fall behind too.

There are 4 things I love about Dia:

1) It's simple and intuitive to do most tasks.
2) Layers.
3) Snapping (to objects, to grids, etc).
4) Tons of file formats to export to.

I would argue that xfig is a lot less powerful, and Graphviz is a lot more involved. And Visio is a whole lot less free! So Dia fills an important niche.

But to each his own! These days I use Dia even for laying out rooms & choosing paint colours, something it was definitely not designed for, but it's pretty darned good at. :)

Cheers,

Johann

Codifex's picture
Submitted by Codifex on

I just had the pleasure of installing and running Dia for the first time. (It looks to be a derivative of Gimp.)

At first, I thought it was a little anemic as far as usefulness goes... that is until I began exploring the floating toolbar.

There are lots of useful "sheets" that contain object shapes from electronic, flowchart, network, and electrical to types I've never heard of before.

It's just what the doctor ordered for my personal project diagramming tasks.

Thanks to the Dia team!
Codifex

I'd rather be flamed with the truth than be left blissfully ignorant.

Author information

Timmy Macdonald's picture

Biography

Timmy Macdonald is a Christian, Ubuntu user and Pythoneer. When he's not studying, coding, or playing a musical instrument, he writes on his blog: http://blog.tsmacdonald.com. Any time left over is spent plotting the demise of the third person.