What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-13 04:10:03
Circular heatmap python
from pylab import * import numpy as np from scipy.interpolate import griddata #create 5000 Random points distributed within the circle radius 100 max_r = 100 max_theta = 2.0 * np.pi number_points = 5000 points = np.random.rand(number_points,2)*[max_r,max... Add solution -
Python 2022-03-12 07:00:02
how to find the labels of the confusion matrix in python
""" In order to find the labels just use the Counter function to count the records from y_test and then check row-wise sum of the confusion matrix. Then apply the labels to the corresponding rows using the inbuilt seaborn plot as shown b... Add solution -
Python 2022-03-02 12:20:01
significant figures on axes plot matplotlib
import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import FormatStrFormatter fig, ax = plt.subplots() ax.yaxis.set_major_formatter(FormatStrFormatter('%g')) ax.yaxis.set_ticks(np.arange(-2, 2, 0.25)) x = np.arange(-1, 1, 0.1) plt... Add solution -
Python 2022-02-18 07:30:05
multiclass classification model
knn=KNeighborsClassifier() svc=SVC() lr=LogisticRegression() dt=DecisionTreeClassifier() gnb=GaussianNB() rfc=RandomForestClassifier() xgb=XGBClassifier() gbc=GradientBoostingClassifier() ada=AdaBoostClassifier() ------------------------------------------... Add solution -
Python 2022-02-16 01:10:02
matplotlib plot two graphs side by side
import matplotlib.pyplot as plt import numpy as np # Simple data to display x = np.linspace(0, 2 * np.pi, 400) y = np.sin(x ** 2) # the container holding the two Axes have already been unpacked # useful if just few Axes have been created f, (ax1, ax2) ... Add solution -
Python 2022-02-15 20:00:08
how to plot side by side bar horizontal bar graph in python
import pandas import matplotlib.pyplot as plt import numpy as np df = pandas.DataFrame(dict(graph=['Item one', 'Item two', 'Item three'], n=[3, 5, 2], m=[6, 1, 3])) ind = np.arange(len(df)) width = 0.4 fig, ax = plt.subplots... Add solution -
Python 2022-02-09 19:35:06
pyplot second y axis
import numpy as np import matplotlib.pyplot as plt # Create some mock data t = np.arange(0.01, 10.0, 0.01) data1 = np.exp(t) data2 = np.sin(2 * np.pi * t) fig, ax1 = plt.subplots() color = 'tab:red' ax1.set_xlabel('time (s)') ax1.set_ylabel('exp', colo... Add solution
Best helpers
Tick tock
+5
Nathaniel
+5
Jela
+5
Snagulus
+5
Rajesh Paul
+5
Ent
+5
Wolf
+5
Jason Heo
+5
Hi-yi
+5
ANeves
+5
Gbarry
+5
Adam Dexter
+5
Scared Guy
+5
Mihaela
+5
Nhgrif
+5
Puoygae
+5
Freddie
+5
Man-kit LI
+5
Naved Ame
+5
Lpapp
+5
John Kuhl
+5
Pars usta
+5
IberoMedia
+5