Function plots in Inkscape

by John on December 21, 2009

Why would you want to plot a mathematical function using a drawing package like Inkscape rather than a mathematical package like Mathematica or R? One reason is that you may want plot for its visual properties. For example, you might want to include a sine wave in a drawing.

Another reason is that you may want to have more control (or at least easier control) over your plot. Mathematical packages make it easy to produce a basic plot with default options. But I’ve found it difficult to change the aesthetics of a plot in every mathematical package I’ve used. The things I want to do are often possible but require arcane options that I have trouble remembering. In a drawing program, it’s obvious how to manipulate a plot as an image.

butterfly curve

Inkscape provides a couple extensions to include function plots in a drawing. One is “Function Plotter” and the other is “Parametric Curves.” Both are found under Extensions -> Render. The following dialog shows the settings used to produce the graph above.

The first time I tried using these extensions nothing happened. Then I discovered you have to select a rectangle to contain the plot before creating a plot; the plotting tools do not create their own rectangles.

The Function Plotter supports rectangular and polar coordinates. You’re in for quite a surprise if you expect rectangular coordinates when the polar coordinates box is checked.

{ 7 comments… read them below or add one }

1

Tomas Olsson 12.22.09 at 08:00

Do you know of an easy way of plotting data using Inkscape?

2

John 12.22.09 at 08:49

I don’t know of a way to plot data, but I wouldn’t be surprised if someone has written such an extension.

The function plotting extension is essentially a Python interpreter. There may be a way to have it call Python code that gives it your data.

3

Tomas Olsson 12.22.09 at 08:58

Well,
I have been trying to find one, but the only thing I have found is rather cumbersome ways of doing it like described at http://trinifar.wordpress.com/2007/02/21/creating-graphs-with-inkscape/ (and in the comments)

Thanks anyway for pointing me to this useful tool.

/Tomas

4

Janne 12.27.09 at 21:28

For data plots I tend to produce a basic plot with gnumeric or similar, and export the plot as an svg file. Then I open that file with inkscape and edit it to make it visually pleasing.

5

Kevin 08.05.10 at 20:24

Hi John
I’m trying to plot the graph above in inkscape. I’m following the image of the dialogue but I’m getting a syntax error. Any idea what could be happening (apart from a typo)?

6

John 08.05.10 at 21:15

Kevin: I just repeated the example in the screen shot and it worked for me. As I mentioned above, the first time I tried it I had a problem because I’d not selected a rectangle first, but that didn’t cause a syntax error.

Maybe you have a typo. Try copying and pasting the following:

sin(t)*(exp(cos(t)) - 2*cos(4*t) - pow(sin(t/12), 5))

cos(t)*(exp(cos(t)) - 2*cos(4*t) - pow(sin(t/12), 5))

7

Kevin 08.06.10 at 08:21

beautiful! thanks!

My mistake was to assume that there were no spaces in the formula(?). is there a rule for putting spaces in so I can check before setting things in motion?

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>