What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-18 18:40:12
matplotlib pie chart label order
import matplotlib.pyplot as plt import pandas as pd #corresponding color-label pairs colors = ['#99f3bd', '#fbaccc', '#a8df65', '#ff7b54'] labels = ["Yes", "Sometimes", "Most of the times", "No"] #... Add solution -
Python 2021-10-17 13:54:07
matplotlib get padding from bbox
import matplotlib matplotlib.rc('text',usetex=True) import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import numpy as np text = '\\begin{tabular}{|c|c|}\\hline1&2\\\\\\hline3&4\\\\\\hline\\end{tabular}' fig, ax = plt.subpl... Add solution -
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-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-08 05:13:03
trends in yearly data python
import matplotlib.pyplot as pltimport matplotlib.dates as mdatesfig, ax = plt.subplots()ax.grid(True)year = mdates.YearLocator(month=1)month = mdates.MonthLocator(interval=3)year_format = mdates.DateFormatter('%Y')month_format = mdates.DateFormatter('%m')... Add solution