TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to reconstruct this picture in MetaPost:

enter image description here

So far came up with this:

draw (-1cm,0)--(3cm,0);
draw (0,1cm)--(0,-1cm);
draw fullcircle scaled 1.8cm;
label(btex $y$ etex,(0,1.2cm));
label(btex $x$ etex,(3.2cm,0));
label(btex \textsf{SVEU\v CILI\v STE U RIJECI} etex,(1cm,1.7cm));
label(btex \textsf{ODJEL ZA MATEMATIKU} etex,(1cm,-1.5cm));

Obviously, the sine graph is missing. I tried a few ways, but I couldn't even get it to compile. Can anyone provide some assistance?

share|improve this question
By the way, I use tlhiv.org/mppreview for compiling MetaPost. – rivanvx Jul 28 '10 at 12:02

Try the following:

draw (-90/360*1.5cm,-0.9cm) for i = -90 upto 630: .. (i/360*1.5cm,0.9cm*(sind(i))) endfor;
share|improve this answer
+1 for answering the question, using metapost (not Tikz), and not using fancy LaTeX dialects (i.e., you avoided LuaLaTeX). – Alex Nelson Dec 23 '12 at 20:17

I know that you said metapost, so I'll probably get voted down for this answer! (In my defence, I suspect that more people are going to be interested in how to draw a sine wave by any means than specifically by metapost, so although this doesn't answer your specific question, it's hopefully close enough to be worth leaving nearby). This is really easy in TikZ: p124 of the manual:

\draw (0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0) sin (5,1);

draws a sine wave.

More generally, TikZ can interact nicely with gnuplot to draw graphs of functions (see the manual for details). Gnuplot does the computation, TikZ does the rendering.

share|improve this answer
Thanks for leaving your answer nearby. – Heath Hunnicutt Sep 20 '12 at 23:21

run it with lualatex which makes the use of MP easier:


\large\textsf{SVEU\v CILI\v STE U RIJECI}

def compute_curve(suffix f)(expr xmin,xmax,xinc) = ( (xmin,f(xmin))
    for x=xmin+xinc step xinc until xmax: ..(x,f(x)) endfor )
vardef f(expr x)=sind(x*180/3.14) enddef;
path g;
draw g xscaled 8pt yscaled 0.9cm withpen pencircle scaled 2bp;
draw (-1cm,0)--(3cm,0);
draw (0,1cm)--(0,-1cm);
draw fullcircle scaled 1.8cm;


enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.