What do you want to save?
Add Code snippet
New code examples
-
Go 2021-08-30 19:28:01
matplotlib logo image on a plot
import matplotlib.image as image import matplotlib.pyplot as plt im = image.imread('debian-swirl.png') fig, ax = plt.subplots() ax.imshow(im, aspect='auto', extent=(0.4, 0.6, .5, .7), zorder=-1) ax.yaxis.tick_left() ax.tick_params(axis='y', colors='black... Add solution -
C 2021-08-28 10:37:02
plt circle
import matplotlib.pyplot as plt circle1 = plt.Circle((0, 0), 0.2, color='r') circle2 = plt.Circle((0.5, 0.5), 0.2, color='blue') circle3 = plt.Circle((1, 1), 0.2, color='g', clip_on=False) fig, ax = plt.subplots() # note we must use plt.subplots, not pl... Add solution -
Python 2021-08-27 15:24:02
python matplotlib two y axis
import numpy as np import matplotlib.pyplot as plt # Create some mock data t = np.arange(0.01, 10.0, 0.01) data1 = np.exp(t) data2 = np.sin(2 * np.pi * t) fig, ax1 = plt.subplots() color = 'tab:red' ax1.set_xlabel('time (s)') ax1.set_ylabel('exp', colo... Add solution -
Python 2021-08-27 14:03:01
plot normal distribution python
import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats import math mu = 0 variance = 1 sigma = math.sqrt(variance) x = np.linspace(mu - 3 * sigma, mu + 3 * sigma, 100) plt.plot(x, stats.norm.pdf(x, mu, sigma)) plt.show() Add solution -
Python 2021-08-27 10:11:02
set title matplotlib
import matplotlib.pyplot as plt plt.title('TITLE') Add solution -
Python 2021-08-27 09:11:02
matplotlib show percentage y axis
import matplotlib.pyplot as plt import numpy as np import matplotlib.ticker as mtick data = [8,12,15,17,18,18.5] perc = np.linspace(0,100,len(data)) fig = plt.figure(1, (7,4)) ax = fig.add_subplot(1,1,1) ax.plot(perc, data) fmt = '%.0f%%' # Format you... Add solution