If I have two variables, say

```x = random.choices([0.25, 0.75], [25, 75])
y = random.choices([0.4, 0.6], [4, 6])
```

how can I plot a 2D chart of with x-axis between 0 and 1, and y-axis between 0 and 1, to show the multiplied probabilities of the two variables, in a heatmap style format? Mar 21 59 views

## 1 answer to this question.

Create pandas.DataFrame , you can use seaborn.jointplot to plot the joint probability.
You can play around with the kind parameter to get the plot you desire.

```import random
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

samples = 100

x = random.choices(population = [0.25, 0.75], weights = [25, 75], k = samples)
y = random.choices(population = [0.4, 0.6], weights = [4, 6], k = samples)

df = pd.DataFrame({'x': x, 'y': y})

sns.jointplot(data = df, x = 'x', y = 'y', kind = 'kde', xlim = (0, 1), ylim = (0, 1))

plt.show()

```  answered Mar 23 by
• 5,480 points

## Calculate the probability in R for sum of two dice rolls

By converting the outer values to a ...READ MORE

## Transition matrix to have percentages instead of default probability - Markov chain

While using Markov chain, is it possible ...READ MORE

## Is there a way to force the coefficient of the independent variable to be a positive coefficient in the linear regression model used in R?

A Few Constraints This is an example of ...READ MORE

## Formula to calculate chance (probability) of a dice side based on its value

If I understand you correctly, you're looking ...READ MORE

+1 vote

## How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

+1 vote

## How to handle Real-Time Matplotlib Plotting

To draw a continuous set of random ...READ MORE

## How to increase plt.title font size?

Try the following : import matplotlib.pyplot as plt plt.figtext(.5,.9,'Temperature', ...READ MORE