What do you want to save?
Add Code snippet
New code examples
-
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 -
Python 2022-02-18 09:15:04
matplotlib change bar color under threshold
import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) N = 5 ind = np.arange(N) width = 0.5 vals = [1,2,3,4,5] colors = ['r','b','b','b','b'] ax.barh(ind, vals, width, color=colors) plt.show() Add solution -
Python 2022-02-11 10:25:01
quadratic equation plot in python
import matplotlib.pyplot as plt import numpy as np # 100 linearly spaced numbers x = np.linspace(0,1,10) eta1=0.05 eta2=0.1 lmd1= 2.8 # the function, which is y = x^2 here y = 0.5*(-(1/3)*eta1*x**2 + np.sqrt( ((1/3)*eta1*x**2)**2-4*(3*x**2*2.8**2-1)) #... Add solution -
Python 2022-02-02 06:06:04
matplotlib animation
import matplotlib.pyplot as plt from matplotlib import cm import numpy as np from celluloid import Camera numpoints = 10 points = np.random.random((2, numpoints)) colors = cm.rainbow(np.linspace(0, 1, numpoints)) camera = Camera(plt.figure()) for _ in ra... Add solution -
Python 2022-02-01 23:31:33
hierarchy dendrogram
>>> ytdist = np.array([662., 877., 255., 412., 996., 295., 468., 268., ... 400., 754., 564., 138., 219., 869., 669.]) >>> Z = hierarchy.linkage(ytdist, 'single') >>> plt.figure() >>> dn = hierarchy.de... Add solution -
Python 2022-01-26 00:25:53
3d plots in python
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x =[1,2,3,4,5,6,7,8,9,10] y =[5,6,2,3,13,4,1,2,4,8] z =[2,3,3,3,5,7,9,11,9,10] ax.scatter(x, y, z, c='r', marker='... Add solution -
Python 2021-11-19 13:36:21
python how to save a Seaborn plot into a file
# Basic syntax: plt.savefig("output.png") # Example usage: plt.figure() plt.plot(range(5)) plt.savefig("output.png", dpi=300) # Note, savefig comes from matplotlib.pyplot and plt is an # abbreviation for this, e.g. import matplotli... Add solution