What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-09 06:17:20
matplotlib animate
import matplotlib.pyplot as plt from matplotlib import cm import numpy as np from celluloid import Camera numpoints = 10 points = np.random.random((2, numpoints)) colors = cm.rainbow(np.linspace(0, 1, numpoints)) camera = Camera(plt.figure()) for _ in ra... Add solution -
Python 2021-11-08 20:34:16
if key in dict python time complexity
""" Time complexity of looking for a value in a hashable object is O(1). Dictionary keys are hashable. The code below is just for demonstration purposes, feel free to run it and see that the plot has no correlation with n. """... Add solution -
Python 2021-11-08 15:54:09
how to make a pairs plot with pandas
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from sklearn import datasets iris_dataset = datasets.load_iris() X = iris_dataset.data Y = iris_dataset.target iris_dataframe = pd.DataFrame(X, columns=iris_dataset.feature_names) ... Add solution -
Python 2021-11-08 08:29:14
python numpy find local minima
import numpy as np from scipy.signal import argrelextrema import matplotlib.pyplot as plt x = np.array([6, 3, 5, 2, 1, 4, 9, 7, 8]) y = np.array([2, 1, 3 ,5 ,3 ,9 ,8, 10, 7]) # sort the data in x and rearrange y accordingly sortId = np.argsort(x) x = x[... 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 -
Python 2021-11-07 05:42:10
matplotlib axis labels
# 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 -
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