# I want to draw a graph on a cylinder in TikZ

Using Tikz, I would like to draw a strip of the triangular lattice graph of width 5 with periodic boundary conditions, illustrating it wrapped around a 3d-cylinder.

Now to explain what all that means: here is a picture from a Physics paper that is the closest approximation to what I want that I could find. If you ignore the red arrows, the blue pole and the text, then this shows a cylinder around which is wrapped a section of square lattice.

All I want different is

• the lattice should be triangular not square - this just means that the squares in this picture should all have one diagonal edge added consistently in the same way so that each vertex (black circle) in the middle of the lattice has six neighbours.
• the width should be 5, so that an ant starting at a vertex and walking around the cylinder will take 5 steps to return to the original position; the above picture seems to have width 8.
• I want the end of the cyclinder to be "closed" so that the entire picture looks like a properly shaded version of the picture below - just like this, the closed end will contain one vertex adjacent to each of the vertices on the rim.

Another variant that is similar to, but not exactly what I want is this:

Any clues in how to get these sort of 3d-shaded effects would be gratefully received.

UPDATE

I have been asked in the comments to show what I have done so far, but my efforts are rather pitiful.

Here is an example where I was doing the same sort of lattice, but of width 4, and I drew it "looking down" the cylinder, so you could see a particular graph (in yellow) that was in the "bottom face" of the cylinder (in red). This at least allowed me to "animate" (via builds) the process of extending the length of the cylinder by adding another layer of red vertices. (This is from a few years ago, before "flat" graphics came back into fashion.)

Here is another variant - this is a square lattice, not triangular, and I have tried to indicate the "wrap around" by the dotted lines. Pretty crap.

Here is how I did it in a paper - again the width is 4 and I tried to say in text that the cut-out strip of lattice should be folded round a cylinder.

Anyway, my goal here is to emphasise that the graph is getting bigger by the addition of one layer after another, and that this drives the behaviour of the graph.

I was more anticipating a pointer to a 3d-drawing tutorial / example from someone that does this regularly rather than actual code for my particular diagram, so I apologise if it came across as that.

• – John Kormylo May 29 '17 at 21:05
• Please post a minimal working example (MWE) of what you have tried so far. Nobody is just going to draw this for you. You have to bring something to the table yourself. – Henri Menke May 30 '17 at 2:00
• Note that TikZ does not do 3D. You can fake it in 2D for simple cases, but if it gets complex, use a different tool. In particular, the right lighting and, therefore, shading, is something about which TikZ knows precisely zilch. You said in November 2011 that you use TikZ for graphics, so, if you really want to use it, you could clearly provide some sort of MWE rather than just a do-it-for-me ;). – cfr Jun 1 '17 at 0:09
• Adding a minimal working example (MWE), doesn't mean to post images. I don't think that the added images (Except the first) will help to clearify your question. A MWE contain compilable code, starting with \documentclass and ending with \end{document}. – Bobyandbob Jun 3 '17 at 10:53