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 want to make in TikZ or MetaPost an image of a two dimensional lattice with oscillations like these:

optical lattice another optical lattice

(Source: http://www.uibk.ac.at/th-physik/qo/research/opticallattices.html)

or this one:

yet another optical lattice

(Source: http://news.sciencemag.org/sciencenow/2008/09/12-01.html)

I don't know even know how to begin.

share|improve this question
Unfortunately I can't vote to close because this question has an open bounty. However I think that your question is off topic. Short version -- Can you do the job for me. – Marco Daniel May 7 '12 at 17:32
Please don't pile on downvotes. A net score of -1 is enough to show that the question needs to be improved. More downvotes should be reserved for questions that are unsalvageable or spam. – Jake May 7 '12 at 18:00
I don't want that people do the job for me I just want some ideas or which package to use! In fact I tried it alone and I did not find a good and short solution! – PanAkry May 7 '12 at 20:16
IMHO this is not more or less off topic than How to draw nanotubes with TeX? – clemens May 8 '12 at 21:29

Here's something to get you (or perhaps someone else) started

enter image description here

I realize that the balls aren't exactly where you want them, but you can tweak the positions yourself.

The idea was to use a surface plot of the function f(x,y)=cos(x)*cos(y) using the pgfplots package.

The only subtlety is to loop through the balls, which requires the loop to be wrapped in \pgfplotsextra{ ... }.

I borrowed Altermundus' ball shading from How can we draw a Christmas tree with decorations, using TikZ?


% borrowed from Altermundus' Christmas tree
% http://tex.stackexchange.com/questions/39149/how-can-we-draw-a-christmas-tree-with-decorations-using-tikz/39250#39250
 \shadedraw[ball color=red] (0,0) circle (60pt);


    y domain=-2*pi:2*pi
    \foreach \deco in {
        (axis cs:-1,-1,1),
        (axis cs:-2,-2,1),
        (axis cs:3,3,1),
        (axis cs:-3,-3,1),
        (axis cs:4,4,1)
        \node at \deco {\usebox{\ball}};
share|improve this answer
Thanks but I have the following error:pgfplots@addplotimpl@expression@curly. Any hint? – PanAkry May 7 '12 at 20:14
@PanAkry make sure your distribution is up to date – cmhughes May 7 '12 at 20:33

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.