What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-06 06:30:30
python how to add a figure legend at the best position
# Short answer: # matplotlib.pyplot places the legend in the "best" location by default # To add a legend to your plot, call plt.legend() # Example usage: import matplotlib.pyplot as plt x1 = [1, 2, 3] # Invent x and y data to be plotted y1 = [... Add solution -
Python 2021-11-21 03:29:22
arduino python matplotlib line
import serial # import Serial Library import numpy # Import numpy import matplotlib.pyplot as plt #import matplotlib library from drawnow import * tempF= [] pressure=[] arduinoData = serial.Serial('com11', 115200) #Creating our serial ob... Add solution -
Python 2021-11-17 14:42:20
python plot legend
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-11-16 14:18:31
plt.legend(
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-11-03 19:55:14
how to scatter plot in matplotlib of two sets
import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) ax1.scatter(x1, y1, s = 10, c = 'b', label = 'elbow') ax1.scatter(x2, y2, s = 10, c = 'r', label = 'shoulder') plt.legend(loc='upper left'); plt.show() Add solution -
Python 2021-10-29 10:07:11
y=mx+b python
import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5,5,100) y = 2*x+1 plt.plot(x, y, '-r', label='y=2x+1') plt.title('Graph of y=2x+1') plt.xlabel('x', color='#1C2833') plt.ylabel('y', color='#1C2833') plt.legend(loc='upper left') plt.gri... Add solution -
TypeScript 2021-10-29 06:02:17
multiple scatter plots in python
import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) ax1.scatter(x1, y1, s = 10, c = 'b', label = 'elbow') ax1.scatter(x2, y2, s = 10, c = 'r', label = 'shoulder') plt.legend(loc='upper left'); plt.show() Add solution -
Other 2021-10-16 03:26:10
simple pendulum with image processing code
import numpy as np from scipy.integrate import odeint import math import matplotlib.pyplot as plt """ damping: effects that reduce the amplitude of the vibrations """ def ode_func(theta,t,b,g,l,m): theta1=theta[0] thet... Add solution