def _draw_subplot(subplot: Subplot, ax: Axes, start: datetime.datetime, end: datetime.datetime): data_series = [line.load(start, end) for line in subplot.lines] for line, data in zip(subplot.lines, data_series): _draw_series(data, ax, line) if subplot.ylim: if np.isfinite(subplot.ylim[0]): ax.set_ylim(bottom=subplot.ylim[0]) if np.isfinite(subplot.ylim[1]): ax.set_ylim(top=subplot.ylim[1]) ax.set_ylabel(subplot.ylabel, fontsize=subplot.plot.fontsize(1.2)) # Show log book entries for the logsite of this subplot # Draw only logs if logsite is a site of the subplot's lines if subplot.logsite in [l.siteid for l in subplot.lines]: # Traverse logs and draw them for logtime, logtype, logtext in subplot.get_logs(): x = np.datetime64(logtime) ax.axvline(x, linestyle='-', color='r', alpha=0.5, linewidth=3) ax.text(x, ax.get_ylim()[0], logtype, ha='left', va='bottom', fontsize=subplot.plot.fontsize(0.9)) ax.set_xlim(subplot.plot.start, subplot.plot.end) for xtl in ax.get_xticklabels(): xtl.set_rotation(15) ax.yaxis.set_major_locator(MaxNLocator(prune='upper')) ax.tick_params(axis='both', which='major', labelsize=subplot.plot.fontsize(1.1)) ax.grid() ax.legend(loc=0, prop=dict(size=subplot.plot.fontsize(1)))
def key_russian_dates(self, ax: _figure.Axes): pass ''' Draws key dates from Russia on plot as vertical lines and spans. ''' for (date, length, name) in self.__dates.get_key_russian_dates(): x = None if length == self.__dates.to_Timedelta(1): ax.axvline(date, color='Gray', alpha=0.6) x = date else: ax.axvspan(date, date + length, color='Gray', alpha=0.6) x = date + length / 2 ax.text(s=name, x=x, y=ax.get_ylim()[1] * .95, rotation=90, ha='center', va='top', fontsize='small', bbox=dict(boxstyle="square,pad=0.6", fc="white", ec=(0.7, 0.7, 0.7), lw=2))