所以我有这个清单
station_list = [1, 2, 3, 4]
Run Code Online (Sandbox Code Playgroud)
这是一个例子,真正的列表可能更长,但总是这个模式增加整数.作为我的代码的一部分,如果满足某些条件,我想在不同于1的点访问该列表.假设我想开始迭代2.如何以2开头迭代列表for-loop,但是仍然得到所有元素一次?所以迭代顺序应该是2, 3, 4, 1.
我正在用熊猫和 pyplot 绘制直方图。有关其他信息,我在直方图分布的某些百分位处添加了线条。我已经发现您可以axvline在整个图表的某个百分比高度上显示:
cycle_df = pd.DataFrame(results)
plot = cycle_df.plot.hist(bins=30, label='Cycle time')
plot.axvline(np.percentile(cycle_df,5), label='5%', color='red', linestyle='dashed', linewidth=2, ymax=0.25)
plot.axvline(np.percentile(cycle_df,95), label='95%', color='blue', linestyle='dashed', linewidth=2, ymax=0.25)
Run Code Online (Sandbox Code Playgroud)
是否可以让红/蓝线恰好在直方图条的末端结束以看起来平滑?