Source code for mtpy.utils.matplotlib_utils

import matplotlib.pyplot as plt
import numpy as np


[docs] def get_next_fig_num(): """Get next fig num.""" current_fig_nums = set(plt.get_fignums()) number = 1 while number in current_fig_nums: number += 1 return number
[docs] def gen_hist_bins(uniq_period_list): """Gen hist bins.""" bins = np.array(uniq_period_list) # get center of bins diff = np.diff(np.r_[0, bins]).dot(0.5) bins -= diff # shift left bins = np.r_[bins, uniq_period_list[-1] + diff[-1]] # add last bar return bins