How do I trace a graph in Inkscape?


enter image description here

Can I draw this graph using Inkscape? I am new to this image editor and I have read the guidelines but it still seems hard to do.
Can you please help me to draw an identical graph that also includes the symbols?

11/11/2013 12:30:00 AM

Accepted Answer

As written in the comments, it's simpler draw manually such a graph. The net is plenty of tutorials, and a good guide to start is Tavmjong Bah one, I've found it really useful.

Please note that Inkscape can be used to draw graphs, but isn't a mathematical specific tool (like Octave, Gnuplot, etc), able to give you an accurate plot of the function. Anyway...

As a starting point, you can import the image in Inkscape (by dragging it in Inkscape or using File->Import), better if in a separate layer (so later you can hidden it):

original image

You can trace the image using Path->Trace Bitmap, tweaking a little and updating the preview until you are satisfied, but usually tracing algorithms creates closed paths and for drawings like this the effect isn't optimal (it's ugly!):

image traced with potrace

A better solution, as evidenced by @DA01, is drawing manually the graphs. It's a very simple operation which involves just lines and text (using the proper fonts you can have symbols too), there are a lot of tutorials on the net and - not last - Inkscape provides extensions to plot functions (see examples here, there, ...). You can lock the layer with the original bitmap, add a new layer and drawing on it (perhaps using guidelines, if it helps):

manual drawing using guidelines

The result is a manual drawing that seems like your graph:

manual drawing cleaned

The best way is reading manuals, following tutorials and trying by yourself: graphs like these are goals which everyone can achieve (perhaps with a more specific tool).

11/11/2013 11:10:00 PM

Based on my limited experience, drawing these curves is a pain, and anyone who knows their mathematical functions can see it's a crude approximation. On the other hand, many modern plotting packages can export to vector based formats, either SVG or PDF, which Inkscape can easily import. So I disagree with the above answer, I think creating the plot and saving it as SVG is by far the easiest, prettiest and mosts elegant solution.

The python/based Matplotlib can export plots to SVG. It is at the base of it a command-line tool (although the IPython Notebook interface is very nice and handy), but for simple plots, it is very easy to use.

from pylab import *
x = linspace(-10, 1-, 1000)  # Start, stop, number of steps
y = sin(x)
plot(x, y)

In the interactive plot window that comes up, one can choose to save the figure as .svg, and then easily imported to Inkscape and styled as you want to.

Easiest way to get it to run fast is to install the Anaconda scientific python distribution. It installs in a single directory, so uninstalling is just a matter of removing that directory.

Also Gnuplot can export to svg. There is a demo/tutorial here. Gnuplot is probably as good as Matplotlib for your purpose, it's just that as a long time Python lover, I'm partial to Python-based plotting tools.

Octave can export to at least PDF, don't know about SVG.