# Which package can easily write a graph, as an arbitrary curve or area, just for indication

Which package can easily write a graph, as an arbitrary curve or area, just for indication? The circle and ellipse don't be considered for their particular shape. TIKZ's Bézier curve is too non-intuitive to use.

-
TikZ with the to[out=angle,in=angle]. See for example tex.stackexchange.com/questions/1175/drawing-a-hypergraph/…. But you should give us more details about what you want. –  Caramdir Mar 15 '11 at 3:46
@Caramdir: I learn a lot from the link. Here is the example, draw this kind of figure intuitively and easily. –  Rushavski Mar 15 '11 at 4:49
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). –  Martin Scharrer Apr 15 '11 at 13:48

## 2 Answers

You can use TikZ \draw plot functionality to get smoothed lines and polygons. TikZ works directly with pdflatex:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\tikz \draw plot [smooth cycle] coordinates {(0,0) (1,0.1) (2,0.3) (2,1.4) (1.5,2.5) (0.8,2.5) (0.3,1.2) (-0.2,0.6) } node at (1,1) {Area};
\tikz \draw plot [smooth,tension=1.2] coordinates {(0,1) (0.75,0.5) (1.5,0.9) (2,0) (2.5,0)} node at (1,0) {Line};
\end{document}


Or, as Andrew Stacey suggested, using random coordinates. You can play around with the seed and the factors for the random part. rnd returns a number between 0 and 1, rand returns a number between -1 and 1.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\pgfmathsetseed{3}
\draw plot [smooth cycle, samples=8,domain={1:8}] (\x*360/8+5*rnd:0.5cm+1cm*rnd) node at (0,0) {Area};
\pgfmathsetseed{2}
\draw plot [smooth, samples=5,domain={1:5},xshift=1cm] (\x+0.5*rnd,0.75*rand) node at (4,-0.75) {Line};
\end{tikzpicture}
\end{document}


-
Now throw in a randomiser on the coordinates! –  Loop Space Mar 15 '11 at 13:01

run with xelatex

\documentclass{article}
\usepackage{pstricks}
\begin{document}

\begin{pspicture}(6,6)
\psccurve[fillstyle=solid,fillcolor=blue!20!red!10](0,0)(2,0.5)(4,1)(6,5)(3,3)(2,5)
\rput(3,2){\Huge\textbf{Curve}}
\end{pspicture}

\end{document}


-
This seems to work fine with the normal latex compiler. I'm just wondering what the special reason is to use xelatex? I do not know it very well and like to learn more about it. –  Martin Scharrer Mar 15 '11 at 8:55
@Martin: The issue is that pstricks won't work with pdflatex. Yes, it should work with the dvi-producing latex. But it also works with xelatex. –  Matthew Leingang Mar 15 '11 at 9:08
@Martin: with xelatex you'll get directly the pdf. ALternatively you can run pdflatex -shell-escape when using \usepackage[pdf]{pstricks} –  Herbert Mar 15 '11 at 9:10
and xelatex does not require shell escape as pdflatex does? why not? –  pluton Mar 15 '11 at 18:47
@pluton because XeLaTeX has a native support of PostScript specials, PDFLaTeX does not. –  yo' Oct 22 '14 at 13:02