Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Center labels matplotlib histogram

n, bins, patches = plt.hist(x, bins=n_bins, edgecolor='black')
ticks = [(patch._x0 + patch._x1)/2 for patch in patches]
ticklabels = [i for i in range(n_bins)]
plt.xticks(ticks, ticklabels)
Comment

pyplot histogram labels in center

import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.random.randn(1000)
n_bins = 10
n, bins, patches = plt.hist(x, bins=n_bins, edgecolor='black')
ticks = [(patch._x0 + patch._x1)/2 for patch in patches]
ticklabels = [i for i in range(n_bins)]
plt.xticks(ticks, ticklabels)
plt.show()

# Check source below for the Graph
Comment

PREVIOUS NEXT
Code Example
Python :: inverse matrix gauss python 
Python :: show only lower diagonal in sns pairplot 
Python :: get linkinstance revit api 
Python :: how to kill python process started by excel 
Python :: how to change color of square in pygame with keypress 
Python :: how to print 2d neatly in python 
Python :: how to sort by date in .csv 
Python :: multiclasshead 
Python :: Checking Availability of user inputted File name 
Python :: python togli spazio 
Python :: python copy formula ghseets 
Python :: sphinx select code ' 
Python :: access dynamicall to name attribute python 
Python :: how to upgrade pip 
Shell :: copy ssh key mac 
Shell :: npm cache clean 
Shell :: how to install pil in anaconda 
Shell :: how to remove mysql workbench in ubuntu 
Shell :: brew install gcloud 
Shell :: notepad++ ubuntu 
Shell :: adb shell list packages 
Shell :: install redis on mac 
Shell :: undo git 
Shell :: how to install python on ubuntu pyenv 
Shell :: ubuntu list file by size 
Shell :: install apt-cyg 
Shell :: heroku logs tail 
Shell :: How to add username and password in github 
Shell :: how to git commit without message 
Shell :: laravel rollback last migration 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =