What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-07 20:37:09
histogram python
import matplotlib.pyplot as plt data = [1.7,1.8,2.0,2.2,2.2,2.3,2.4,2.5,2.5,2.5,2.6,2.6,2.8, 2.9,3.0,3.1,3.1,3.2,3.3,3.5,3.6,3.7,4.1,4.1,4.2,4.3] #this histogram has a range from 1 to 4 #and 8 different bins plt.hist(data, range=(1,4), bins=8) plt... Add solution -
Python 2021-10-07 17:17:08
label axis matplotlib
# Basic syntax: plt.xlabel("X axis label") # Add ", fontsize = #" to control fontsize plt.ylabel("Y axis label") # Example usage: plt.plot(range(5)) plt.xlabel("X axis label") plt.ylabel("Y axis label") p... Add solution -
Python 2021-10-06 23:49:03
bar labeling in matplotlib
import matplotlib.pyplot as plt %matplotlib inline plt.style.use('ggplot') x = ['Nuclear', 'Hydro', 'Gas', 'Oil', 'Coal', 'Biofuel'] energy = [5, 6, 15, 22, 24, 8] x_pos = [i for i, _ in enumerate(x)] plt.bar(x_pos, energy, color='green') plt.xlabel(&q... Add solution -
Python 2021-10-06 12:08:04
python line chart
import matplotlib.pyplot as plt Year = [1920,1930,1940,1950,1960,1970,1980,1990,2000,2010] Unemployment_Rate = [9.8,12,8,7.2,6.9,7,6.5,6.2,5.5,6.3] plt.plot(Year, Unemployment_Rate) plt.title('Unemployment Rate Vs Year') plt.xlabel('Year') plt.ylab... Add solution -
Python 2021-10-06 10:59:02
annotate diagonal python
import matplotlib.pyplot as plt import numpy as np def addtext(ax, props): ax.text(0.5, 0.5, 'text 0', props, rotation=0) ax.text(1.5, 0.5, 'text 45', props, rotation=45) ax.text(2.5, 0.5, 'text 135', props, rotation=135) ax.text(3.5, 0.... Add solution