Question: def plot _ distribution ( arr ) : # Define bins unit _ bins = np . array ( [ # Plot the data arr
def plot
distribution
arr
:
# Define bins
unit
bins
np
array
# Plot the data arr using unit
bins, assign the plot to histplot
histplot
return histplot
faces
range
histplot
plot
distribution
faces
Question a
Define a function plotdistribution that takes an array of numbers integers or decimals and draws the histogram of the distribution using unit bins centered at the integers and white edges for the bars. The histogram should be drawn to the density scale, and the opacity should be The leftmost bar should be centered at the smallest integer in the range of the array and the rightmost bar at the largest integer in the range of the array. The display does not need to include the printed proportions and bins. No titles or labels are required for this question. For grading purposes, assign your plot to histplot.
If you have trouble defining the function, go back and carefully read all the lines of code that resulted in the probability histogram of the number of spots on one roll of a die. Pay special attention to the bins.
Hint:
See plthist documentation.
What is the left endpoint of the leftmost bar? What is the right endpoint of the rightmost bar? You may find min max and round helpful.
If you implement the function correctly, you should get a plot like this:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
