[update: Since this tutorial is one of the most popular posts on the blog, I'm thinking about writing another about how I do highly accurate charts like the ones in this post. If you have questions and/or suggestions or just think such a tutorial would be a good idea, leave a comment. The motivation will be helpful.]
This brief tutorial shows how to use Inkscape to create graphs like the ones used on this blog.
I’m using Inkscape version 0.43 on a Debian Linux box. More recent versions are available and Windows is supported. The following assumes you have looked at the canned tutorials “Basics” and “Shapes” under Inkscape’s Help menu; they are short and sweet.
getting started
Let’s use this data set:
| year |
population (in millions) |
| 1950 | 152 |
| 1960 | 181 |
| 1970 | 205 |
| 1980 | 228 |
| 1990 | 250 |
| 2000 | 282 |
| 2010 | 309 |
| 2020 | 336 |
| 2030 | 364 |
| 2040 | 392 |
| 2050 | 420 |
to create this graph:

tick marks for the x-axis
To begin, we’ll create the tick marks for the x-axis. Open a new file and use the pen tool
to draw a tick mark, a short vertical line: 
Bring up the File and Stroke dialog with the
on the main toolbar or Shift+Ctrl+F. From the Stroke paint tab, set the color.

From the Stroke style tab, set the width to 3.

One other detail: turn stroke scaling off with the
button in this group
on the second of the two horizontal toolbars. When the button is depressed stroke scaling is on and the stroke size will be scaled when objects are resized. Normally that’s what you want, but turn it off for now.
We need 11 tick marks on the X-axis so duplicate the one you made ten times. One way is to select it and use the stamp tool; that is, while dragging the object with the mouse, press the spacebar. Each press of the spacebar “stamps” a copy of the object at the current location.

Or you can use the duplicate button
on the main toolbar or Ctrl+D to make copies one on top of the other. Move one of the copies to the side:

Use the Align & Distribute dialog
to align the tick marks and spread them out evenly.
Tick marks distributed evenly:

Then aligned:

year labels
Follow a similar process to add the year labels. Use the Text tool
to create the individual dates:

You may want to use the Font & Text dialog
to make the font size smaller than the default (I used 9 point).
Then align and distribute with
:

the Align & Distribute dialog 

- Learn to use the different choices in the Relative to dropdown list. To get the year 2050 to be centered underneath its tick mark, I clicked on the tick mark first to select it, then shift-clicked on the year to include it in the selection. By setting Relative to to “First selected,” pushing the center-vertically button caused the tick mark to stay in place and the year object to move into alignment.
- By centering just the year 1950 to its tick mark and 2050 to it’s tickmark, you can then select all the years and push the “make horizontal gaps between objects equal” button to arrange the remaining year objects properly. Since the tick marks are evenly distributed horizontally and you have centered the first and last of the year objects vertically under their respective tick marks, all the other years will also be centered under their tick marks after the distribution.
general tips
- Use the zoom control
(in the bottom left of the Inkscape window) when ever you are having difficulty selecting individual objects. The 1 key will set zoom to 100%, 2 to 50%, and ` (backtick) cycles through recently used and some preset levels. - The arrow keys individually and combined with Shift and Alt move the selected objects in increments from 1 to 10 pixels — often more convenient than the mouse. By default: Shift-arrow 10, Alt-arrow 1, and arrow alone 2.
- Grouping and ungrouping objects can be a big help. See the canned tutorials.
finishing up the axes
Now lets finish up the axes. Use
to add the x-axis at the top of the tick marks, or copy, rotate, and stretch one of the tick marks:

Use the same method to create the y-axis:

Then move them into the proper relationship:

adding the data
Let’s add the data points. Use the Polygon tool
to create a small star and, with the Fill and Stroke dialog
, set the Fill color to white and the Stroke paint to blue. Duplicate, align, and distribute as before to get this:

Now move each star with the arrow keys to its final destination. (They are all in the correct horizontal position and the up/down arrows will move only vertically.)
If you a finicky about accuracy (as I am) there are several ways to get the data points located with precision. You might build a temporary measuring tool, a little grid that you can align with the ticks on the y-axis as shown here:

Or you can use the guides which are pulled out from the rulers at the top and left of the drawing area. Or you can use # to toggle the grid. Tabs on the Document Preferences dialog
enable “snapping” behavior and, in the case of the grid, adjust it’s size.
Use
to change the star at 2010 to red. Press Ctrl+C (Edit —> Copy). Select all the stars from 2020 to 2050 and then Shift+Ctrl+V (Edit —> Paste Style).
With
click on each of the stars. Select the new line and change its color and width to something that suits you. Press the End key or the toolbar button to send it to the bottom of the stack — under all the stars (related functions are on the Object menu). Use the edit path node tool
if you need to adjust the line.
finish up
Now add the remaining labels and the legend using
to situate them and you’re done. The result looks like this:

Since is Inkscape about scalable vector graphics, resizing the graph is trivial. Select it and drag one of the handles. If you want to maintain the current aspect ratio, hold down the Ctrl key while resizing.
To create a PNG file, select the graph and press the export button
on the main toolbar.
a few more ideas
With a little practice, creating a graph like this is a five minute exercise, but of course there is far more you can do and many different techniques to increase your productivity.
You might use OpenOffice Calc or something equivalent to generate the data for the graphs, but neither Calc nor Excel can give you anything like the control that Inkscape will for generating the graphs themselves. (Note: OpenOffice Draw is a good tool which can export to SVG format, but be forewarned that SVG file created by OpenOffice will not have all the information to be easily manipulated by Inkscape.)
If you have a JPG image of a graph and want to create a variant to highlight, for instance, a particular aspect of the data, use the import button
to bring the JPG into Inkscape, then use the pen
to trace over it.
Another technique is to use a spreadsheet program to generate a graph, then import the resulting image into Inkscape and trace it.
Learn to use the layer control
— especially when creating anything complex. For example, for a graph with several series of data points, you can put each series in its own layer and work on it without modifying the rest of the drawing.
With the pen
you can create arbitrary closed shapes which the Fill and Stroke dialog
can fill with color and alter the stroke properties.
Download the OpenClipArt package of SVG files (some 6500). They are often directly useful, but also serve as starting points and examples. See also WikiMedia’s SVG drawings.
If you want to manipulate an existing JPG image use GIMP. If you want to create a graph or chart use Inkscape. Read about SVG file format here and here. Currently Firefox 1.5+ and Opera display SVG out of the box but Internet Explore requires a plugin.
In the beginning of this tutorial you turned off stroke scaling
. Don’t forget to turn it back on.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License. For attribution please link back to this page.




Wow, that is an excellent tutorial. You’re a pro!
I’m definitely going to download Inkscape and refer to this the next time I want to make a graph.
You mention GIMP. I toyed with it in the past, but found it a bit unwieldy. Not needing all it’s capabilities I went to Irfanview for some time. But now I’ve switched to the FastStone Image viewer:
http://www.faststone.org/index.htm
Simple to use with a couple of features Irfanview lacks (e.g., drop-shadow). It’s good for the everyday stuff, though I’m sure if I’d really taken the time to learn GIMP I’d be using it.
Thanks for writing this!
Thanks for the compliments, John. I hear you on GIMP — it’s a big complex tool. I probably know about 10% of it (about the same with Inkscape). These days I mostly use GIMP to do screen/window captures and cropping, rather like having a modern kitchen and only using the microwave. If the FastStone Image viewer serves your needs for image manipulation, stick with it.
I really can’t say enough about Inkscape (and SVG) as a drawing tool. Do give it a try.
great tutorial, very detailed – i am going to add a link to this in the unofficial tutorials section of inkscape’s wiki:
http://wiki.inkscape.org/wiki/index.php/TutorialsAndHelp
thanks for sharing the tut – and pluggin openclipart library too…
i have been trying to write some tuts for inkscape lately as well…
also, if you havent checked out inkscape 0.45 – there is one feature in there i find super cool and useful – the blur filter…
thanks again,
ryanlerch
also, a while a ago, i was playing around with graphs in inkscape for some stats about the open clipart library – here is the result that i came up with…
http://openclipart.org/people/ryanlerch/ryanlerch_uploads_graph.png
cheers again,
ryanlerch
Thanks, Ryan, for stopping by, for putting the tutorial into the OpenClipArt wiki, and for the compliment on the turorial itself! I’ll upgrade to Inkscape 0.45 once I get a few things off my plate. The photorealistic drawings some people have done with it are awesome.
Editorial note: Ryan is a contributor to the OpenClipArt project. He also has a cool blog https://ryanler.wordpress.com/ with Inkscape and GIMP tutorials of his own.
Thanks for the tutorial, it would have been a great time-saver back then when I started to create graphs using inkscape
I just wanted to point out, that plots generated with tools like (xm)grace and gnuplot can the one way or the other (pstoedit -> svg, mostly) get seamlessy imported into inkscape for enhancing them (write/arrange formulas within the plot, color parts of the plot differently, overlay graphs, … )
Keep up the work!
Cya Martin
Martin, thanks for the tip.
[...] http://trinifar.wordpress.com/2007/02/21/creating-graphs-with-inkscape/ [...]
Google translation
Hi Trinifar
sorry my english is bad, very bad.
I go to verify, if somebody of the inkscape-Brasil list can make the translation.
good tutorial.
Xterminator,
Welcome to Trinifar. If you find a translator who wants or needs my original SVG or PNG files, send me an email. My email address is here http://trinifar.wordpress.com/contact/
Tradução Portuguese de Google:
Boa vinda a Trinifar. Se você encontrar um tradutor que queira ou necessite minhas limas originais de SVG ou de PNG, emitir-me um email. Meu email address está aqui http://trinifar.wordpress.com/contact/
Those are some mighty fine charts in the Quads blog. I would love to learn how you did it.
I’ve used Inkscape in some scientific graphs, they look a lot nice than those you can get with OpenOffice at this time. I used Cntrl-Shift-X to edit the locations of the points directly. I put my data in a spreadsheet as an X and Y column, then in the thrid colum I put the line delimiter character, ‘L’. Cut’n'paste this data into the XML schema and hit the ‘Set’ button and Presto!