这是这篇文章的一个后续问题,其中讨论了轴,刻度和标签的着色.我希望为此开一个新的,扩展的问题是可以的.
add_subplot使用轴[ax1,ax2] 围绕双图(通孔)更改完整框架(刻度线和轴)的颜色会产生大量代码.此代码段会更改上图的框架颜色:
ax1.spines['bottom'].set_color('green')
ax1.spines['top'].set_color('green')
ax1.spines['left'].set_color('green')
ax1.spines['right'].set_color('green')
for t in ax1.xaxis.get_ticklines(): t.set_color('green')
for t in ax1.yaxis.get_ticklines(): t.set_color('green')
for t in ax2.xaxis.get_ticklines(): t.set_color('green')
for t in ax2.yaxis.get_ticklines(): t.set_color('green')
Run Code Online (Sandbox Code Playgroud)
因此,为了改变两个图的帧颜色,每个两个y轴,我需要16(!)行代码...这是它的样子:

到目前为止我挖出的其他方法:
matplotlib.rc:这里讨论; 全球而非本地变化.我想要一些不同颜色的其他情节.请不要在情节中讨论太多颜色...... :-)
matplotlib.rc('axes',edgecolor='green')
Run Code Online (Sandbox Code Playgroud)挖出轴的刺,然后改变它:这里也讨论过 ; 我觉得并不是很优雅.
for child in ax.get_children():
if isinstance(child, matplotlib.spines.Spine):
child.set_color('#dddddd')
Run Code Online (Sandbox Code Playgroud)是否有一种优雅的方式来凝聚上面的块,更多的是"pythonic"?
我在ubuntu下使用python 2.6.5和matplotlib 0.99.1.1.
我经常读到两个概念都完全不同,但我找不到关于差异所在的好解释.捆绑依赖关系并限制与外界的交谈.
我应该何时将应用程序打包到容器中进行部署?什么时候封装的包装更好?
API通常具有用户必须遵循的速率限制。例如,让我们接受50个请求/秒。顺序请求需要0.5-1秒,因此太慢了,无法接近该限制。但是,使用aiohttp的并行请求超出了速率限制。
为了尽可能快地轮询API,需要对并行调用进行速率限制。
到目前为止,我发现的示例装饰了session.get,大致像这样:
session.get = rate_limited(max_calls_per_second)(session.get)
Run Code Online (Sandbox Code Playgroud)
这对于顺序调用非常有效。尝试在并行调用中实现此功能无法按预期进行。
这是一些示例代码:
async with aiohttp.ClientSession() as session:
session.get = rate_limited(max_calls_per_second)(session.get)
tasks = (asyncio.ensure_future(download_coroutine(
timeout, session, url)) for url in urls)
process_responses_function(await asyncio.gather(*tasks))
Run Code Online (Sandbox Code Playgroud)
问题在于它将限制任务的排队速度。与的执行gather将或多或少地同时发生。两全其美;-)。
是的,我在aiohttp处发现了一个类似的问题:设置每秒的最大请求数,但没有答复回答限制请求速率的实际问题。同样,来自Quentin Pradet的博客文章仅在限制队列速率上起作用。
总结一下:如何限制并行请求的每秒aiohttp请求数?