What do you want to save?
Add Code snippet
New code examples
-
-
Other 2021-09-15 01:40:03
grid_data=d.iloc[index].as_matrix( ).reshape(28,28) not working
# display or plot a number. plt.figure(figsize=(7,7)) idx = 100 grid_data = d.iloc[idx].as_matrix().reshape(28,28) # reshape from 1d to 2d pixel array plt.imshow(grid_data, interpolation = "none", cmap = "gray") plt.show() print(l[idx]) Add solution -
Other 2021-09-13 23:04:02
how to plot a scatter plot in matplotlib
# Import matplotlib import matplotlib.pyplot as plt # Set plot space as inline for inline plots and qt for external plots %matplotlib inline # Set the figure size in inches plt.figure(figsize=(10,6)) plt.scatter(x, y, label = "label_name" ) ... Add solution -
Other 2021-09-09 06:07:01
display values on countplot
plt.figure(figsize=(12,8)) ax = sns.countplot(x="AXLES", data=dfWIM, order=[3,4,5,6,7,8,9,10,11,12]) plt.title('Distribution of Truck Configurations') plt.xlabel('Number of Axles') plt.ylabel('Frequency [%]') for p in ax.patches: ax.ann... Add solution -
Other 2021-09-08 22:59:02
percentage stacked bar chart sns
# import libraries import seaborn as sns import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches # load dataset tips = sns.load_dataset("tips") # set the figure size plt.figure(figsize=(14, 14)) # from raw val... Add solution -
Python 2021-09-08 04:23:03
matplotlib add legend axis x
fig = plt.figure(figsize=(10,5)) ax = fig.add_subplot(111) ax.set_title('ADR vs Rating (CS:GO)') ax.scatter(x=data[:,0],y=data[:,1],label='Data') plt.plot(data[:,0], m*data[:,0] + b,color='red',label='Our Fitting Line') ax.set_xlabel('ADR') ax.set_ylabel... Add solution -
Python 2021-09-06 20:14:01
how to increase the figure size in matplotlib
plt.figure(figsize=(20,10)) Add solution -
Other 2021-09-03 20:31:01
change xlabel rotate in seaborn
# Basic syntax: plt.set_xticklabels(plt.get_xticklabels(), rotation=45, horizontalalignment='right') # Example usage: import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # Import data data = pd.read_csv("https://raw.githubuser... Add solution -
Python 2021-08-31 10:55:04
matplotlib plt.sapect
plt.figure(figsize=(10,3)) plt.plot(x,y) plt.show() Add solution