What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-01 03:02:02
plot 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-01 01:54:02
python add a point to a plot
# Basic syntax plt.plot(x, y, 'marker') # Example usage: import matplotlib.pyplot as plt import numpy as np # Data to plot x = np.linspace(0, 10, 100) # Plot figure fig = plt.figure() plt.plot(x, np.sin(x), '-') # Add point plt.plot(5, 0, 'ro') # Not... Add solution -
Python 2021-09-30 18:21:04
bar chart in python
import numpy as np import matplotlib.pyplot as plt data = [[30, 25, 50, 20], [40, 23, 51, 17], [35, 22, 45, 19]] X = np.arange(4) fig = plt.figure() ax = fig.add_axes([0,0,1,1]) ax.bar(X + 0.00, data[0], color = 'b', width = 0.25) ax.bar(X + 0.25, data[1]... Add solution -
Python 2021-09-30 02:00:07
set axis labels python
# 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-09-29 11:58:05
cmap perlin noise python
import random from perlin_noise import PerlinNoise import matplotlib.pyplot as plt noise = PerlinNoise(octaves=10, seed=random.randrange(1,1000000000000000)) xpix, ypix = 100, 100 pic = [[noise([i/xpix, j/ypix]) for j in range(xpix)] for i in range(ypix)... Add solution -
Python 2021-09-28 23:00:03
y =mx+c trend analysis in for a column of dataframe
import matplotlib.pyplot as pltimport matplotlib.dates as mdatesfig, ax = plt.subplots()ax.grid(True)year = mdates.YearLocator(month=1)month = mdates.MonthLocator(interval=3)year_format = mdates.DateFormatter('%Y')month_format = mdates.DateFormatter('%m')... Add solution