What do you want to save?
Add Code snippet
New code examples
-
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 -
Other 2022-02-01 22:36:47
fibonacci sphere python
from numpy import pi, cos, sin, arccos, arange import mpl_toolkits.mplot3d import matplotlib.pyplot as pp num_pts = 1000 indices = arange(0, num_pts, dtype=float) + 0.5 phi = arccos(1 - 2*indices/num_pts) theta = pi * (1 + 5**0.5) * indices x, y, z = c... Add solution -
Python 2022-02-01 14:12:26
k means clustering python medium
import pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport numpy as np# read data into variable Iris_dataIris_data = pd.read_csv("D:\ProjectData\Iris.csv")#display first few rows of dataIris_data.head() Add solution -
Shell/Bash 2022-01-29 13:15:34
matplotlib change he yticks to two number after digit
from matplotlib.ticker import StrMethodFormatter plt.gca().yaxis.set_major_formatter(StrMethodFormatter('{x:,.0f}')) # No decimal places plt.gca().yaxis.set_major_formatter(StrMethodFormatter('{x:,.2f}')) # 2 decimal places Add solution -
Python 2022-01-29 09:26:37
k-means
import tkinter as tk from tkinter import filedialog import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt from sklearn.cluster import KMeans from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg root= tk.Tk() canvas1... Add solution -
Python 2022-01-29 07:42:13
Image to grayscale using python
import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg def rgb2gray(rgb): return np.dot(rgb[...,:3], [0.299, 0.587, 0.144]) img = mpimg.imread('img.png') gray = rgb2gray(img) plt.imshow(gray, cmap='gray') plt.savefig(... Add solution