What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-17 20:58:01
multiple plot in one figure python
import matplotlib.pyplot as plt plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here') plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here') plt.legend(loc='best') plt... Add solution -
Python 2021-09-16 15:45:02
mathplolib avec date
import matplotlib.pyplot as plt data = [49, 20, 37, 28, 20] jours = ["14/02/2016", "15/02/2016", "17/02/22016", "28/05/2016", "15/07/2016"] plt.plot(data) #1 seul argument: 'data' plt.x... Add solution -
Python 2021-09-14 16:45:03
piecewise linear regression python
from scipy import optimize def piecewise_linear(x, x0, x1, b, k1, k2, k3): condlist = [x < x0, (x >= x0) & (x < x1), x >= x1] funclist = [lambda x: k1*x + b, lambda x: k1*x + b + k2*(x-x0), lambda x: k1*x + b + k2*(x-x0) + k3*(x -... Add solution -
Python 2021-09-09 22:35:02
change each line color as a rainbow python
from matplotlib.pyplot import cm import numpy as np #variable n below should be number of curves to plot #version 1: color=cm.rainbow(np.linspace(0,1,n)) for i,c in zip(range(n),color): plt.plot(x, y,c=c) #or version 2: color=iter(cm.rainbow(np.li... Add solution -
Python 2021-09-08 04:23:03
matplotlib add legend axis x
fig = plt.figure(figsize=(10,5)) ax = fig.add_subplot(111) ax.set_title('ADR vs Rating (CS:GO)') ax.scatter(x=data[:,0],y=data[:,1],label='Data') plt.plot(data[:,0], m*data[:,0] + b,color='red',label='Our Fitting Line') ax.set_xlabel('ADR') ax.set_ylabel... Add solution -
Python 2021-09-06 15:17:01
matplotlib legend out of plot
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 20, 1000) y1 = np.sin(x) y2 = np.cos(x) plt.plot(x, y1, "-b", label="sine") plt.plot(x, y2, "-r", label="cosine") plt.legend(loc="upper le... Add solution -
Python 2021-09-05 07:54:02
position of legend matplotlib
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 20, 1000) y1 = np.sin(x) y2 = np.cos(x) plt.plot(x, y1, "-b", label="sine") plt.plot(x, y2, "-r", label="cosine") plt.legend(loc="upper le... Add solution