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 2022-01-24 01:55:39
xaxis matplotlib
import matplotlib.pyplot as plt x = [0.00001,0.001,0.01,0.1,0.5,1,5] # create an index for each tick position xi = list(range(len(x))) y = [0.945,0.885,0.893,0.9,0.996,1.25,1.19] plt.ylim(0.8,1.4) # plot the index for the x-values plt.plot(xi, y, marker='... 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-14 21:26:20
plotting graphs in keras
# Visualize training history from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt import numpy # load pima indians dataset dataset = numpy.loadtxt("pima-indians-diabetes.csv", delimiter=","... Add solution -
Python 2021-11-08 07:46:12
python add vertical line in plot
# Basic syntax: plt.axvline(x_coordinate) # Example usage: import matplotlib.pyplot as plt plt.figure(figsize=(5, 5)) plt.axvline(x=10, ymin=0.10, ymax=0.70, color='b', ls='--', lw=1.5, label='axvline - % of full height') plt.legend(bbox_to_anchor=(1.0, ... Add solution -
Other 2021-11-04 19:31:12
how to add vertical line on subplot in matplotlib
import numpy as np import matplotlib.pyplot as plt xs = np.linspace(1, 21, 200) plt.figure(figsize=(10, 7)) # only one line may be specified; full height plt.axvline(x=36, color='b', label='axvline - full height') # only one line may be specified; ymi... Add solution