MatrixGamePlot

MatrixGamePlot[mgame]

generates a plot of the MatrixGame mgame.

MatrixGamePlot[mgame,strat]

highlight the game strategy strat.

Details and Options

Examples

open allclose all

Basic Examples  (4)

Generate a two-player matrix game:

Plot the game:

Generate the Prisoner's Dilemma:

Plot the game using split squares:

Generate a game:

Show strategies using an array of the same dimensions as the GameActionLabels array:

Generate the Nash Poker game:

Plot the game such that the third player is on the rows:

Scope  (5)

Two-Player Games  (3)

Generate a two-player zero-sum matrix game:

Plot the game:

Generate a two-player matrix game:

Plot the game:

Generate a Stag Hunt game:

Plot the game:

Multiplayer Games  (2)

Generate a four-player matrix game:

Plot the game using split squares:

Generate a Volunteer's Dilemma game with four players:

Plot the game to demonstrate its symmetry:

Options  (6)

PlotLayout  (1)

Generate a game:

Use the default "BarChart" plot:

Use the "SplitSquare" plot:

Use a list of player index {{r1,,rk},{c1,,cn-k}} to group the n players as row players {r1,,rk} and column players {c1,,cn-k}:

The player order may be added to the layout style:

ColorFunction  (1)

Generate a game:

Specify the color scheme used as seen in ColorData:

ColorFunctionScaling  (1)

Generate a game:

Specify the color scaling for continuous color schemes between 0 and 1:

GameActionLabels  (1)

Generate a game:

Show the dataset:

Choose the action labels in the plot (hover over the lines of each player disk to view):

GamePlayerLabels  (1)

Generate a game:

Choose the player labels in the plot:

PlotLegends  (1)

Generate a game:

Plot it with a legend:

This is particularly useful in the case of the style "SplitSquare":

Applications  (9)

Recreational Games  (2)

Rock Paper- Scissors is a zero-sum game, where either one player wins and the other loses, or there is a tie. The plot style "SplitSquare" is best for two-player games:

This plot uses gray for the losing player (lowest value), a vibrant blue or orange for the winning player (highest value) and a pale orange or blue for a tie (average value).

Generalize Rock Paper Scissors to Rock Paper Scissors Fire Water by setting up dominance order using a graph:

Show the plot:

Social Games  (1)

The Volunteer's Dilemma describes a situation where each player can either volunteer or defect. If at least one player volunteers, all other players marginally benefit from defecting. If no player volunteers, all players have a very low payoff. Generate a Volunteer's Dilemma game with four players:

The best way to visualize most games of more than two players is using the default "Barchart" style. Plot the game:

However, in the "SplitSquare" style, it is not clear what happens to players based on their choices:

A better visualization can be given by isolating a player:

The difference between volunteering and defecting is marginal,except where all players defect:

Prisoner's Dilemma  (2)

Consider a Prisoner's Dilemma game:

Show the dataset:

Consider that each player has a dominating strategy: to defect.

Naturally, the intersection of dominating strategies is a Nash equilibrium:

Show this strategy visually:

Consider an Optional Prisoner's Dilemma game:

Visualize the game:

Attempt to find the Nash equilibria:

As indicated, the number of solutions is infinite, thus requiring further analysis:

The player strategy {0,0,1} is not a dominating strategy, as one may verify:

However, the strategy {{0,0,1},{0,0,1}} is a Nash equilibrium:

Economics Games  (3)

Three hungry men go to the restaurant and decide to split the bill evenly before ordering. There are three meal options, Cheap, Mediocre and Expensive. Represent this situation as a MatrixGame:

Plot the game:

Find the Nash equilibrium:

The Cournot Oligopoly game describes a situation where a group of firms produces the same good. Each firm must consider the production cost and the quantity the other firms are producing. Only the firms with the lowest price sell goods.

Generate a Cournot Oligopoly game:

Find the optimal game strategies in this game:

This is intuitive when considering for all players, the payoffs are largest for the second action:

A price war refers a game where multiple firms have an interest in offering the lowest price, but the payoff of any firm is directly correlated to the price chosen. Consider a price war between three firms where each firm has the choice between a low price and a high price:

Visualize the game:

Despite the common interest of having the price as high as possible, competition creates a Nash equilibrium at the low price:

Symmetry in Games  (1)

An easy way to visualize the symmetry or differences between player payoffs is to plot them using different row and column players. For example, consider the difference between pure coordination and dangerous coordination games. In the former, players have the same payoffs:

If a game is symmetric over players, then any permutation that maintains the shape of the plot should show equivalent payoffs:

Neat Examples  (1)

Consider a large Matrix Game with six players having three actions each:

Wolfram Research (2025), MatrixGamePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixGamePlot.html.

Text

Wolfram Research (2025), MatrixGamePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixGamePlot.html.

CMS

Wolfram Language. 2025. "MatrixGamePlot." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MatrixGamePlot.html.

APA

Wolfram Language. (2025). MatrixGamePlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixGamePlot.html

BibTeX

@misc{reference.wolfram_2024_matrixgameplot, author="Wolfram Research", title="{MatrixGamePlot}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixGamePlot.html}", note=[Accessed: 15-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_matrixgameplot, organization={Wolfram Research}, title={MatrixGamePlot}, year={2025}, url={https://reference.wolfram.com/language/ref/MatrixGamePlot.html}, note=[Accessed: 15-January-2025 ]}