What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-20 09:17:57
central limit theorem python example
import numpy as npimport matplotlib.pyplot as pltdef repeat_sample_draws_exponential(n, samp_size, mu, show_all=False): means = [] samples = [] for ii in range(0, n): samples.append(np.random.exponential(mu, samp_size)) means.append... Add solution -
Python 2021-11-20 00:32:16
plt subplots figsize
f, axs = plt.subplots(2,2,figsize=(15,15)) Add solution -
Python 2021-11-16 11:06:19
how to set axis range matplotlib
# For a given y=time-dependent variable, x=time fig, ax = plt.subplots(figsize=(12, 6)) ax.plot(y, label='y') #'lower' is lower limit of the range you wanna set #'upper' is upper limit of the range you wanna set plt.xlim(lower, upper) Add solution -
Python 2021-11-15 14:14:28
this figure includes axes that are not compatible with tight_layout, so results might be incorrect
fig, ax = plt.subplots() fig.set_tight_layout(False) X = np.linspace(-np.pi, np.pi, 256,endpoint=True) C,S = np.cos(X), np.sin(X) ax.plot(X,C) ax.plot(X,S) plt.show() Add solution -
Other 2021-11-15 09:11:18
visualizing logistic regression separator plane
f, ax = plt.subplots(figsize=(8, 6)) ax.contour(xx, yy, probs, levels=[.5], cmap="Greys", vmin=0, vmax=.6) ax.scatter(X[100:,0], X[100:, 1], c=y[100:], s=50, cmap="RdBu", vmin=-.2, vmax=1.2, edgecolor="white... Add solution -
Python 2021-11-12 01:57:14
second y axis matplotlib
import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 10, 0.1) y1 = 0.05 * x**2 y2 = -1 *y1 fig, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot(x, y1, 'g-') ax2.plot(x, y2, 'b-') ax1.set_xlabel('X data') ax1.set_ylabel('Y1 data', color='... Add solution -
Python 2021-11-03 23:07:07
matplotlib secondary x axis
import matplotlib.pyplot as plt import numpy as np import datetime import matplotlib.dates as mdates from matplotlib.transforms import Transform from matplotlib.ticker import ( AutoLocator, AutoMinorLocator) fig, ax = plt.subplots(constrained_layout=... Add solution -
TypeScript 2021-10-28 20:47:12
matplotlib subplots size
f, axs = plt.subplots(2,2,figsize=(15,15)) Add solution