What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-16 04:58:04
how to display the first 25 images from training dataset
plt.figure(figsize=(10,10))for i in range(25): plt.subplot(5,5,i+1) plt.xticks([]) plt.yticks([]) plt.grid(False) plt.imshow(train_images[i], cmap=plt.cm.binary) plt.xlabel(class_names[train_labels[i]])plt.show() Add solution -
Other 2021-10-13 19:53:03
pairplot seaborn legend best position set
g = sns.pairplot(iris, hue='species', palette='husl', markers='d', size=2.5, plot_kws= { "s":40, "alpha":1.0, 'lw':0.5, 'edgecolor':'k' }) handles = g._legend_data.values() labels = g._legend_data.keys() g.fig.... Add solution -
Python 2021-10-11 15:34:07
Python scatter with histogram
# Create some normally distributed data mean = [0, 0] cov = [[1, 1], [1, 2]] x, y = np.random.multivariate_normal(mean, cov, 3000).T # Set up the axes with gridspec fig = plt.figure(figsize=(6, 6)) grid = plt.GridSpec(4, 4, hspace=0.2, wspace=0.2) main_a... Add solution -
Other 2021-10-09 22:15:13
matplotlib hover event
x = np.random.rand(15) y = np.random.rand(15) names = np.array(list("ABCDEFGHIJKLMNO")) c = np.random.randint(1,5,size=15) norm = plt.Normalize(1,4) cmap = plt.cm.RdYlGn fig,ax = plt.subplots() sc = plt.scatter(x,y,c=c, s=100, cmap=cmap, norm=... Add solution -
Python 2021-10-09 16:14:09
matplotlib twinx legend
import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('mathtext', default='regular') time = np.arange(10) temp = np.random.random(10)*30 Swdown = np.random.random(10)*100-10 Rn = np.random.random(10)*100-10 fig = plt.figure() a... Add solution