What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-25 00:05:02
matplotlib hist
import matplotlib.pyplot as plt data = [1.7,1.8,2.0,2.2,2.2,2.3,2.4,2.5,2.5,2.5,2.6,2.6,2.8, 2.9,3.0,3.1,3.1,3.2,3.3,3.5,3.6,3.7,4.1,4.1,4.2,4.3] #this histogram has a range from 1 to 4 #and 8 different bins plt.hist(data, range=(1,4), bins=8) plt... Add solution -
Python 2022-03-17 07:50:19
Highlighting the shortest path in a Networkx graph
import matplotlib.pyplot as plt G = nx.karate_club_graph() pos = nx.spring_layout(G) nx.draw(G,pos,node_color='k') # draw path in red path = nx.shortest_path(G,source=14,target=16) path_edges = zip(path,path[1:]) nx.draw_networkx_nodes(G,pos,nodelist=path... 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-03-02 09:20:03
python gaussian filter
>>> from scipy import misc >>> import matplotlib.pyplot as plt >>> fig = plt.figure() >>> plt.gray() # show the filtered result in grayscale >>> ax1 = fig.add_subplot(121) # left side >>> ax2 = fig.a... Add solution