Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plot histogram from counts and bin edges

import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots()

counts = np.array([20, 19, 40, 46, 58, 42, 23, 10, 8, 2])
bin_edges = np.array([0.5, 0.55, 0.59, 0.63, 0.67, 0.72, 0.76, 0.8, 0.84, 0.89, 0.93])

ax.bar(x=bin_edges[:-1], height=counts, width=np.diff(bin_edges), align='edge', fc='skyblue', ec='black')
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: is str in pzthon 
Python :: scrape website with login python selenium 
Python :: password protected cmd python 
Python :: try and except in python 
Python :: wkhtmltopdf pdfkit blocked access to file 
Python :: ValueError: Graph disconnected: cannot obtain value for tensor Tensor("input_3_1:0", shape=(None, None, 71), dtype=float32) at layer "input_3". The following previous layers were accessed without issue: [] 
Python :: how to start coding in python 
Python :: Renaming and replacing the column variable name 
Python :: json payload python function 
Python :: how to make simple login in python 
Python :: boto3 rename file s3 
Python :: define event on socketio python 
Python :: time zone 
Python :: Python script to SSH to server and run command 
Python :: python booleans 
Python :: loop in python 
Python :: convert image to binary python 
Python :: python reverse a list 
Python :: TypeError: method() takes 1 positional argument but 2 were given 
Python :: using shebang python 
Python :: how to print text in python 
Python :: xargs in python 
Python :: python sort a list using defined order 
Python :: How to perform topological sort of a group of jobs, in Python? 
Python :: pyqt graph 
Python :: get_queryset django rest framework 
Python :: gtk label set label 
Python :: google.protobuf.Struct example python 
Python :: pandas fillna multiple columns 
Python :: list insert python 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =