# How to draw graphs

Maybe this question should not be here, but for me it seems the only way to get the answer! My questions are:

• Which program a mathematician can use to write a paper in mathematics which contains a lot of geometrical graphs?
• How they drew the pictures in the books?
• Is it just hand drawing and then paste in a proper place in the paper? Or the only way is to be very professional in LaTeX?
• Is there any computer program converts a hand-draw picture into a digital code?
-
– Claudio Fiandrino Mar 31 '13 at 6:59
I would recommend splitting up your question as it only concerns LaTeX a little bit and is more about current practices in (mathematical) publishing. There are at least a hundred different plotting/graphing software packages out there that mathematicians currently use. Hardly anything today is hand drawn/digitized. LaTeX is important for the typesetting, it can incorporate different image formats as graphs. – Alexander Mar 31 '13 at 11:03

There are many ways to draw diagrams with computers.

• If you like drawing with click and drag or with drawing pad, then you have to use:

• Inkscape,
• Illustrator (commercial),
• Freehand (commercial),
• SolidWorks (commercial),
• 3D Studio Max (commercial),
• GeoGebra,
• etc.
• If you prefer scripting then you can use:

Hand-drawn diagrams can be converted to digital ones by

• scanning them to get rastered images
• vectorizing the rastered images to get vector graphics.

Using a search engine you can find many "raster to vector" converters.

-
Why no pgfplots? – Harish Kumar Mar 31 '13 at 7:04
@HarishKumar: I thought it belongs to TikZ's world so I did not need to mention it explicitly. – kiss my armpit Mar 31 '13 at 7:12
@percusse: Fortunately, Octave is free! – Dror Mar 31 '13 at 7:40
@Dror Well I wouldn't call it fortunately but indeed I missed it :) – percusse Mar 31 '13 at 8:24
@percusse: But where is your previous comment? :-) – kiss my armpit Mar 31 '13 at 8:32

If you have some background with the terminal/command line, then I would suggest the following tools.

Perhaps an overkill for many people, but how about python with numpy/scipy. And how about sage which is also built on top of python?

gnuplot is also a powerful free and open source graphing utility that can be used as a standalone application or with LaTeX packages pgfplots and tkz-fct. You can search this site for examples. For instance, the post: pgfplots: post-processing data created with gnuplot

R is a free and open source statistical software that is also widely used. It even has Sweave and knit-r packages just for running R commands in a TeX document. There have also been several examples in this site about these packages.

When I was using Windows, I remember also to have used winplot for simple graphs.

Most standalone graphics software has the ability to export into picture files. These can then be included in your LaTeX document with the \includegraphics command. For LaTeX graphing packages like pgfplots which is built on top of tikz on the other hand, you can write the code directly into your .tex document.

## Update

I forgot to mention Scilab, which is also a free alternative to Matlab.

If you are looking for something to draw graphs in Graph Theory, you might want to look at tkz-berge which is also built on top of tikz. Here is an example from the manual.

\documentclass[10pt,tikz,convert,border=5]{standalone}

\usepackage{tkz-berge}

\begin{document}
\begin{tikzpicture}
\tikzset{VertexStyle/.style = {shape = circle,
ball color = green,
minimum size = 24pt,
draw},
EdgeStyle/.style = {thick,
double = orange,
double distance = 1pt,
}}
\SetVertexLabel\SetVertexMath
\grCrown[RA=3,RS=6]{4}
\end{tikzpicture}
\end{document}

-
From OP's previous Q, he might be looking at algebraic topology graphs related to graph theory. although i am not a pure math expert. – texenthusiast Mar 31 '13 at 15:39
@texenthusiast Perhaps. Anyway, I included an example. – hpesoj626 Apr 1 '13 at 1:25

Check out the TikZ/PGF package. You can find plenty of examples at www.texample.net, and the package manual can be found here, and contains a very comprehensive introduction.

There is also the pstricks package. But personally I like TikZ better because you can directly compile the code with pdflatex.

I'm not aware of any program that can digitize hand-drawn pictures. Even if there is, like the ones that convert hand-written equations to LaTeX codes, I suspect that its output cannot have the same quality as those produced by a plotting program.

-
You should try potrace (command-line) or Incscape to convert raster graphics to vector format. The result clearly depends on the image, but it could be very impressive. – g.kov Mar 31 '13 at 14:58
@g.kov: Really? I'll definitely check it out – Herr K. Mar 31 '13 at 16:48