What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-16 23:45:06
Three-dimensional Points and Lines
ax = plt.axes(projection='3d') # Data for a three-dimensional line zline = np.linspace(0, 15, 1000) xline = np.sin(zline) yline = np.cos(zline) ax.plot3D(xline, yline, zline, 'gray') # Data for three-dimensional scattered points zdata = 15 * np.random.r... 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-10 07:35:02
python scatterplot figsize
plt.figure(figsize=(8, 8)) plt.scatter(x, y) 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 -
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 10:25:36
plot two axes plotly
import plotly.graph_objects as go from plotly.subplots import make_subplots # Create figure with secondary y-axis fig = make_subplots(specs=[[{"secondary_y": True}]]) # Add traces fig.add_trace( go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name... Add solution -
Other 2022-01-30 16:01:21
Scatter graph
# the iris dataset is provided by R natively # Create a color palette library(paletteer) colors <- paletteer_c(package = "ggthemes", palette = "Green-Blue-White", n = 3) # Scatterplot with categoric color scale plot( x = iris$Pe... Add solution