本文整理匯總了Python中matplotlib.pyplot.loglog方法的典型用法代碼示例。如果您正苦於以下問題:Python pyplot.loglog方法的具體用法?Python pyplot.loglog怎麽用?Python pyplot.loglog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.pyplot
的用法示例。
在下文中一共展示了pyplot.loglog方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_wcc_distribution
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_wcc_distribution(_g, _plot_img):
"""Plot weakly connected components size distributions
:param _g: Transaction graph
:param _plot_img: WCC size distribution image (log-log plot)
:return:
"""
all_wcc = nx.weakly_connected_components(_g)
wcc_sizes = Counter([len(wcc) for wcc in all_wcc])
size_seq = sorted(wcc_sizes.keys())
size_hist = [wcc_sizes[x] for x in size_seq]
plt.figure(figsize=(16, 12))
plt.clf()
plt.loglog(size_seq, size_hist, 'ro-')
plt.title("WCC Size Distribution")
plt.xlabel("Size")
plt.ylabel("Number of WCCs")
plt.savefig(_plot_img)
示例2: plot_distance_comparisons
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_distance_comparisons(self, distance1, distance2, logaxis=False,
figure_size=(7, 5), filename=None, filetype="png", dpi=300):
"""
Creates a plot comparing different distance metrics for the
specific rupture and target site combination
"""
xdist = self._calculate_distance(distance1)
ydist = self._calculate_distance(distance2)
plt.figure(figsize=figure_size)
if logaxis:
plt.loglog(xdist, ydist, color='b', marker='o', linestyle='None')
else:
plt.plot(xdist, ydist, color='b', marker='o', linestyle='None')
plt.xlabel("%s (km)" % distance1, size='medium')
plt.ylabel("%s (km)" % distance2, size='medium')
plt.title('Rupture: M=%6.1f, Dip=%3.0f, Ztor=%4.1f, Aspect=%5.2f'
% (self.magnitude, self.dip, self.ztor, self.aspect))
_save_image(filename, filetype, dpi)
plt.show()
示例3: PlotOrthogonalResiduals
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def PlotOrthogonalResiduals(ModelX, ModelY, DataX, DataY):
"""
"""
# setup the figure
Fig = CreateFigure(AspectRatio=1.2)
# Get residuals
Residuals, OrthoX, OrthoY = OrthogonalResiduals(ModelX, ModelY, DataX, DataY)
# plot model and data
plt.loglog()
plt.axis('equal')
plt.plot(ModelX,ModelY,'k-', lw=1)
plt.plot(DataX,DataY,'k.', ms=2)
# plot orthogonals
for i in range(0,len(DataX)):
plt.plot([DataX[i],OrthoX[i]],[DataY[i],OrthoY[i]],'-',color=[0.5,0.5,0.5])
plt.savefig(PlotDirectory+FilenamePrefix + "_ESRSOrthoResiduals.png", dpi=300)
示例4: example2
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def example2():
"""
Compute the GRADEV of a nonstationary white phase noise.
"""
N=1000 # number of samples
f = 1 # data samples per second
s=1+5/N*np.arange(0,N)
y=s*np.random.randn(1,N)[0,:]
x = [xx for xx in np.linspace(1,len(y),len(y))]
x_ax, y_ax, (err_l, err_h) , ns = allan.gradev(y,data_type='phase',rate=f,taus=x)
plt.loglog(x_ax, y_ax,'b.',label="No gaps")
y[int(0.4*N):int(0.6*N,)] = np.NaN # Simulate missing data
x_ax, y_ax, (err_l, err_h), ns = allan.gradev(y,data_type='phase',rate=f,taus=x)
plt.loglog(x_ax, y_ax,'g.',label="With gaps")
plt.grid()
plt.legend()
plt.xlabel('Tau / s')
plt.ylabel('Overlapping Allan deviation')
plt.show()
示例5: plot_fee_rates
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_fee_rates(fee_rates):
exponent_min = -6
exponent_max = 0
bin_factor = 10
bins_log = 10**np.linspace(
exponent_min, exponent_max, (exponent_max - exponent_min) * bin_factor + 1)
print(bins_log)
fig, ax = plt.subplots(figsize=standard_figsize, dpi=300)
ax.axvline(x=1E-6, c='k', ls='--')
ax.hist(fee_rates, bins=bins_log)
plt.loglog()
ax.set_xlabel("Fee rate bins [sat per sat]")
ax.set_ylabel("Number of channels")
plt.tight_layout()
plt.show()
示例6: plot_base_fees
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_base_fees(base_fees):
exponent_min = 0
exponent_max = 5
bin_factor = 10
bins_log = 10**np.linspace(
exponent_min, exponent_max, (exponent_max - exponent_min) * bin_factor + 1)
fig, ax = plt.subplots(figsize=standard_figsize, dpi=300)
ax.hist(base_fees, bins=bins_log)
ax.axvline(x=1E3, c='k', ls='--')
plt.loglog()
ax.set_xlabel("Base fee bins [msat]")
ax.set_ylabel("Number of channels")
plt.tight_layout()
plt.show()
示例7: plot_cltv
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_cltv(time_locks):
exponent_min = 0
exponent_max = 3
bin_factor = 10
bins_log = 10**np.linspace(
exponent_min, exponent_max, (exponent_max - exponent_min) * bin_factor + 1)
fig, ax = plt.subplots(figsize=standard_figsize, dpi=300)
ax.hist(time_locks, bins=bins_log)
plt.loglog()
ax.set_xlabel("CLTV bins [blocks]")
ax.set_ylabel("Number of channels")
plt.tight_layout()
plt.show()
示例8: fig_memory_usage
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def fig_memory_usage():
# FAST memory
x = [1,3,7,14,30,90,180]
y_fast = [0.653,1.44,2.94,4.97,9.05,19.9,35.2]
# ConvNetQuake
y_convnet = [6.8*1e-5]*7
# Create figure
plt.loglog(x,y_fast,"o-")
plt.hold('on')
plt.loglog(x,y_convnet,"o-")
# plot markers
plt.loglog(x,[1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5],'o')
plt.ylabel("Memory usage (GB)")
plt.xlabel("Continous data duration (days)")
plt.xlim(1,180)
plt.grid("on")
plt.savefig("./figures/memoryusage.eps")
plt.close()
示例9: fig_run_time
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def fig_run_time():
# fast run time
x_fast = [1,3,7,14,30,90,180]
y_fast = [289,1.13*1e3,2.48*1e3,5.41*1e3,1.56*1e4,
6.61*1e4,1.98*1e5]
x_auto = [1,3]
y_auto = [1.54*1e4, 8.06*1e5]
x_convnet = [1,3,7,14,30]
y_convnet = [9,27,61,144,291]
# create figure
plt.loglog(x_auto,y_auto,"o-")
plt.hold('on')
plt.loglog(x_fast[0:5],y_fast[0:5],"o-")
plt.loglog(x_convnet,y_convnet,"o-")
# plot x markers
plt.loglog(x_convnet,[1e0]*len(x_convnet),'o')
# plot y markers
y_markers = [1,60,3600,3600*24]
plt.plot([1]*4,y_markers,'ko')
plt.ylabel("run time (s)")
plt.xlabel("continous data duration (days)")
plt.xlim(1,35)
plt.grid("on")
plt.savefig("./figures/runtimes.eps")
示例10: plot_losses
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_losses(loss_vals, loss_names, filename, title, xlabel, ylabel, spacing=0):
"""
Given a list of errors, plot the objectives of the training and show
"""
plt.close('all')
for li, lvals in enumerate(loss_vals):
iterations = range(len(lvals))
# lvals.insert(0, 0)
if spacing == 0:
plt.loglog(iterations, lvals, '-',label=loss_names[li])
# plt.semilogx(iterations, lvals, 'x-')
else:
xvals = [ii*spacing for ii in iterations]
plt.loglog( xvals, lvals, '-',label=loss_names[li])
plt.grid()
plt.legend(loc='upper left')
plt.title(title)
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.savefig(filename)
plt.close('all')
示例11: _scale_curve
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def _scale_curve(self):
"""
Puts the data-misfit and regularizing function values in the range
[-10, 10].
"""
if self.loglog:
x, y = numpy.log(self.dnorm), numpy.log(self.mnorm)
else:
x, y = self.dnorm, self.mnorm
def scale(a):
vmin, vmax = a.min(), a.max()
l, u = -10, 10
return (((u - l) / (vmax - vmin)) *
(a - (u * vmin - l * vmax) / (u - l)))
return scale(x), scale(y)
示例12: plot_powA
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_powA(k,powNbody,powLPT,powRecon,LxN,RxN,label,c_i):
c = plt.rcParams['axes.prop_cycle'].by_key()['color']
ax1.loglog(k,powLPT,color = c[c_i],ls='--')
ax1.loglog(k,powRecon,color=c[c_i],ls=':')
l0=ax1.loglog(k,powNbody,color=c[c_i],ls='-',label=label)
l1 = ax2.plot(k, powLPT/powNbody,color = c[c_i],ls='--')
l2 = ax2.plot(k, powRecon/powNbody,label = label,color = c[c_i],ls=':')
ax2.axhline(y=1, color='k', linestyle='--')
ax3.loglog(k, 1-(LxN/np.sqrt(powLPT*powNbody))**2,color = c[c_i],ls='--')
ax3.loglog(k, 1-(RxN/np.sqrt(powRecon*powNbody))**2,color = c[c_i],ls=':')
return l0,l1,l2
#----------plot residual -----------------#
示例13: _fractal_correlation_plot
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def _fractal_correlation_plot(r_vals, corr, d2):
fit = 2 ** np.polyval(d2, np.log2(r_vals))
plt.loglog(r_vals, corr, "bo")
plt.loglog(r_vals, fit, "r", label=r"$D2$ = %0.3f" % d2[0])
plt.title("Correlation Dimension")
plt.xlabel(r"$\log_{2}$(r)")
plt.ylabel(r"$\log_{2}$(c)")
plt.legend()
plt.show()
示例14: _fractal_dfa_plot
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def _fractal_dfa_plot(windows, fluctuations, dfa):
fluctfit = 2 ** np.polyval(dfa, np.log2(windows))
plt.loglog(windows, fluctuations, "bo")
plt.loglog(windows, fluctfit, "r", label=r"$\alpha$ = %0.3f" % dfa[0])
plt.title("DFA")
plt.xlabel(r"$\log_{2}$(Window)")
plt.ylabel(r"$\log_{2}$(Fluctuation)")
plt.legend()
plt.show()
# =============================================================================
# Utils MDDFA
# =============================================================================
示例15: plot_fourier_spectrum
# 需要導入模塊: from matplotlib import pyplot [as 別名]
# 或者: from matplotlib.pyplot import loglog [as 別名]
def plot_fourier_spectrum(time_series, time_step, figure_size=(7, 5),
filename=None, filetype="png", dpi=300):
"""
Plots the Fourier spectrum of a time series
"""
freq, amplitude = get_fourier_spectrum(time_series, time_step)
plt.figure(figsize=figure_size)
plt.loglog(freq, amplitude, 'b-')
plt.xlabel("Frequency (Hz)", fontsize=14)
plt.ylabel("Fourier Amplitude", fontsize=14)
_save_image(filename, filetype, dpi)
plt.show()