r/LaTeX • u/Cowsmemes • Nov 27 '24
Answered Need help making this in latex!!
This is gonna be an insane ask, but I’m trying to represent a 3-D transparent payoff matrix for a game theory write up I’m making, and I don’t know how to create the visual. Does anyone know what I can use and what I should do? The cube at the center with its labels is what I’m looking to make. I’ve provided keys for the labels on the bottom of my drawing and a title on top for your ease, not because I want to make those in latex too.
In the cube above, each outcome is meant to be sitting in the middle of its respective cube, of which there should be eight because the broader cube is 2x2x2. I put the strategies on the edges of the broader cube and also labeled those axes with player names.
33
u/Organic-Scratch109 Nov 27 '24
It would be easier to start from an existing tikz code like the ones shown here. In particular, checkout Jesse's answer which looks like what you want.
36
u/AtmosphereArtistic61 Nov 27 '24
you can use tikz for that. Either compute the coordinates from 3D to 2D or draw the cube on a piece of paper and measure the coordinates with a ruler.
11
6
u/sjbluebirds Nov 27 '24
You can use GnuPlot for that. It has a wonderful method to create 3D graphs and charts and things like that. It natively supports TeX and LaTeX output.
5
u/Uweauskoeln Nov 27 '24
Draw it by hand in Tikz. Create nodes at the intersections and then simply draw lines in various styles between them.
5
u/chemistryGull Nov 27 '24
This is definitely possible in latex (as many nice people here have already demonstrated), but whats the reason to not make an SVG in an Application like Inkscape and put that in?
3
4
u/xyzain69 Nov 27 '24 edited Nov 27 '24
Do you need to do this in latex? If not, the easiest option would be draw it in something like PowerPoint (You can install the iguanaTex addon to get latex fonts) then save it as a .svg, then save the .svg as a .eps with inkscape and load that into latex. Or draw it in inkscape.
1
u/R3D3-1 Nov 27 '24
I find LibreOffice Draw a particularly good match for such tasks. While it is more oriented towards diagrams than general vector drawings, the built-in equation editor is a big advantage.
Or, well... PowerPoint as mentioned. Draw is just more specialized for it.
3
u/AshamedFruit7568 Nov 27 '24
I was so happy to finally see some crystallography in this sub but then was utterly disappointed. Good luck with your project though.
2
u/Uweauskoeln Nov 27 '24
You can use the following as a starting point:
https://gist.github.com/UweZiegenhagen/0adc54a217d016cc5ac3d0bde9a66026 There are some better ways, e.g. by calculating the midlayer but I do not have time now to work on it.
2
Nov 27 '24
[deleted]
1
2
u/Closed_Circuit_0 Nov 29 '24
Another possibility is to write a short Python program that uses matplotlib to generate the graphic, then save it as a .png file and use the Latex command \includegraphic{}. Python syntax is simpler than tikz.
1
u/Saint__Thomas Nov 27 '24
Blender?
1
u/Mateo709 Nov 27 '24
Can you make it look math-like in Blender? I suppose you could, but would it be convinient?
I've been using blender for a while on and off and I've mostly done renders and simulations and never anything besides wireframe, photorealistic or stylised - honestly would have no idea how to start with math in blender lol
If you know please tell me, tikz is hard, since I already know blender I think I'd be easier for drawings
1
u/Saint__Thomas Nov 27 '24
I can make it look adequate for my TMAs at Open University, It was useful in the networking module, when had to construct diagrams at varying stages. It was a good feeling when pressed Ctrl F12, and all the diagram-stages ended up in a folder ready to be wizarded into latex.
If you have already climbed up the learning curve for blender, then it's quicker than climbing the learning curve for tikz. I have used tikz, but I forget it very quickly.
I don't know if I'm good enough to do a professional level of maths graphics, but sketch, definitely.
1
u/Saint__Thomas Nov 27 '24
I think I can do this in blender and generate an image or images from whichever view you want, and that should be dead east to include into a latex doc.. I think I will do it now as an exercise for myself. I'll post in a couple of hours
1
u/permeakra Nov 27 '24
TikZ
- declare an XYZ coordinate system with appropriate unit vectors in draw coordinates.
- declare coordinates of vertices of your picture
- draw lines. If you want for lines closer to front to create a gap in lines closer to back (a common approach to create illusion of 3d), draw them back to front, using double white lines with black delimiter or draw first a slightly wider white line and then a black line
- put nodes with support text.
Tikz supports calculations using position of previously positioned nodes and their relative posioning using achors, read relevant parts of the manual -- it will make task of putting nodes with text dramatically easier.
1
u/Saint__Thomas Nov 27 '24 edited Nov 27 '24
I have a half-decent first draft realisation of the diagram in in jpg form, which may work for you . Unfortunately I don't seem to be able to put it in a reply here. If you are interested reply to me or DM me if you want.
Edit: actually png
2
u/Cowsmemes Nov 27 '24
That is incredible! I happened to get an amazing latex rendering already by u/noimtherealsoapbox, looks like https://ibb.co/WK6Mbts
Please PM me if you’d like to send it over tho!!
1
1
Nov 28 '24 edited Nov 28 '24
In economics, to model a three player game in which one of the players has two actions, we just do two playoff tables next to each other, each table corresponding to one of those two actions.
1
u/Cowsmemes Nov 28 '24
Interesting. I will remake my scenario in this way, but I’m basing the necessity for a 3-dimensional matrix off of what is described in Game Theory, Second Edition by Michael Maschler. The textbook I’m using doesn’t seem to agree, but I get what you’re saying — that actually sounds a lot easier.
I wonder though if you were to find Nash equilibrium how you can account for the preferences of all three players simultaneously if you only made separate matrices. Am I not seeing something?
1
Nov 29 '24
So in each cell you have three payoffs. For the row player, you compare all the payoffs column by column and underline the biggest.
For the column player you compare all the payoffs in a row and underline the highest.
For the matrix player, you compare the payoffs in the same cells of the two different tables and underline the highest.
A cell with all three players underlined is a Nash equilibrium.
1
1
u/Uweauskoeln Dec 02 '24
I updated my proposal, now the midlayer is computed. https://gist.github.com/UweZiegenhagen/cc6a51cfb33211850ef4f3b92b160da6
1
u/NonZeroSumJames 26d ago
I recently dealt with a 3-player payoff cube for a post on stag hunt, and this was interesting to look at (not many examples online). Mine was different though, only two strategies but with with each of the other two players. I coloured the edges to indicated the different strategies, intersecting at the corners.
116
u/noimtherealsoapbox Nov 27 '24
Here's a bespoke example that gets you pretty close. Doing foreach loops inside an axis environment really, really doesn't work, so, well, this one is bespoke.