How to Create a Poisson Probability Mass Function Plot in Python? Last Updated : 14 Aug, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will see how we can create a Poisson probability mass function plot in Python. In probability theory and statistics, the Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space if these events occur with a known constant mean rate and independently of the time since the last event. The Poisson distribution can also be used for the number of events in other specified intervals such as distance, area or volume. In order to plot the Poisson distribution, we will use scipy module. SciPy is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers and other tasks common in science and engineering.In order to get the poisson probability mass function plot in python we use scipy's poisson.pmf method. Syntax : poisson.pmf(k, mu, loc)Argument : It takes numpy array, shape parameter and location as argumentReturn : It returns numpy array Example 1: Python3 # importing poisson from scipy from scipy.stats import poisson # importing numpy as np import numpy as np # importing matplotlib as plt import matplotlib.pyplot as plt # creating a numpy array for x-axis x = np.arange(0, 100, 0.5) # poisson distribution data for y-axis y = poisson.pmf(x, mu=40, loc=10) # plotting the graph plt.plot(x, y) # showing the graph plt.show() Output : Example 2: Using step size of data as 1 Python3 # importing poisson from scipy from scipy.stats import poisson # importing numpy as np import numpy as np # importing matplotlib as plt import matplotlib.pyplot as plt # creating a numpy array for x-axis # using step size as 1 x = np.arange(0, 100, 1) # poisson distribution data for y-axis y = poisson.pmf(x, mu=10, loc=40) # plotting the graph plt.plot(x, y) # showing the graph plt.show() Output: Example 3: Plotting scatterplot for better viewing of data points Python3 # importing poisson from scipy from scipy.stats import poisson # importing numpy as np import numpy as np # importing matplotlib as plt import matplotlib.pyplot as plt # creating a numpy array for x-axis x = np.arange(0, 100, 0.5) # poisson distribution data for y-axis y = poisson.pmf(x, mu=50, loc=0) # plotting thescatter plot graph plt.scatter(x, y) # showing the graph plt.show() Output: Comment More infoAdvertise with us Next Article How To Find Probability Distribution in Python R rakshitarora Follow Improve Article Tags : Python Python-matplotlib Python-scipy Practice Tags : python Similar Reads How To Find Probability Distribution in Python A probability Distribution represents the predicted outcomes of various values for a given data. Probability distributions occur in a variety of forms and sizes, each with its own set of characteristics such as mean, median, mode, skewness, standard deviation, kurtosis, etc. Probability distribution 3 min read How to plot a normal distribution with Matplotlib in Python? Normal distribution, also known as the Gaussian distribution, is a fundamental concept in probability theory and statistics. It is a symmetric, bell-shaped curve that describes how data values are distributed around the mean. The probability density function (PDF) of a normal distribution is given b 4 min read How to Create an Ogive Graph in Python? In this article, we will create an Ogive Graph. An ogive graph can also be called as cumulative histograms, this graph is used to determine the number of values that lie above or below a particular value in a data set. The class interval is plotted on the x-axis whereas the cumulative frequency is p 4 min read Calculate and Plot a Cumulative Distribution function with Matplotlib in Python Cumulative Distribution Functions (CDFs) show the probability that a variable is less than or equal to a value, helping us understand data distribution. For example, a CDF of test scores reveals the percentage of students scoring below a certain mark. Letâs explore simple and efficient ways to calcu 3 min read How To Make Density Plot in Python with Altair? Density plots are a variation of Histograms that are used to observe the distribution of a variable in data set over a continuous interval or a time period. The peaks of a Density Plot indicate where values are concentrated over an interval. Compared to Histograms, Density Plots are better at determ 2 min read How to Create a Swarm Plot with Matplotlib Swarm plots, also known as beeswarm plots, are a type of categorical scatter plot used to visualize the distribution of data points in a dataset. Unlike traditional scatter plots, swarm plots arrange data points so that they do not overlap, providing a clear view of the distribution and density of d 5 min read Like