What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-09 06:17:20
matplotlib animate
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 2021-11-03 06:57:09
plot scatter python
# 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 -
Python 2021-10-29 16:50:16
how to read iris data in python
print(__doc__) # Code source: Gaël Varoquaux # Modified for documentation by Jaques Grobler # License: BSD 3 clause import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets from sklearn.decomposition imp... Add solution -
Python 2021-10-29 02:35:14
python scatter plot legend
# credit to the Stack Overflow user in the source link import matplotlib.pyplot as plt from numpy.random import random colors = ['b', 'c', 'y', 'm', 'r'] lo = plt.scatter(random(10), random(10), marker='x', color=colors[0]) ll = plt.scatter(random(10),... Add solution -
Other 2021-10-27 20:12:06
sklearn decision tree regressor
Import the necessary modules and libraries import numpy as np from sklearn.tree import DecisionTreeRegressor import matplotlib.pyplot as plt # Create a random dataset rng = np.random.RandomState(1) X = np.sort(5 * rng.rand(80, 1), axis=0) y = np.sin(X).... Add solution -
Python 2021-10-24 13:47:15
matplotlib units of scatter size
star = MarkerStyle('*') bbox = star.get_path().transformed(star.get_transform()).get_extents() star_unit_width = bbox.width star_unit_height = bbox.height plt.scatter(0, -1, marker='s', s=(xscale*desired_data_width/star_unit_width)**2) Add solution -
Python 2021-10-19 09:15:16
scatter plot python
# 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 -
Python 2021-10-18 17:13:10
how to plot labeled data with different colors
import matplotlib import matplotlib.pyplot as plt import numpy as np x = [4,8,12,16,1,4,9,16] y = [1,4,9,16,4,8,12,3] label = [0,1,2,3,0,1,2,3] colors = ['red','green','blue','purple'] fig = plt.figure(figsize=(8,8)) plt.scatter(x, y, c=label, cmap=matp... Add solution -
Other 2021-10-09 22:15:13
matplotlib hover event
x = np.random.rand(15) y = np.random.rand(15) names = np.array(list("ABCDEFGHIJKLMNO")) c = np.random.randint(1,5,size=15) norm = plt.Normalize(1,4) cmap = plt.cm.RdYlGn fig,ax = plt.subplots() sc = plt.scatter(x,y,c=c, s=100, cmap=cmap, norm=... Add solution
Best helpers
Ranking is empty