Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _set_plot(self):
- figure = plt.figure()
- figure.set_size_inches(self._size[0], self._size[1])
- figure.text(0.25, 0.002, self._disclaimer, family="monospace", va="baseline", fontsize=9)
- # ==========================================
- # ==========================================
- # Creating plots grid
- gs = gridspec.GridSpec(3, 3)
- ax1 = figure.add_subplot(gs[0, :])
- ax2 = figure.add_subplot(gs[1, :], sharex=ax1)
- ax3 = figure.add_subplot(gs[2, 0])
- ax4 = figure.add_subplot(gs[2, -1])
- ax5 = figure.add_subplot(gs[2, -2])
- # Set tics visibility
- # plt.setp(ax1.get_xticklabels(), visible=False)
- # ==========================================
- # AX1
- # ==========================================
- ax1.xaxis_date()
- ax2.xaxis_date()
- ax1.xaxis.set_major_formatter(self._time_format)
- ax2.xaxis.set_major_formatter(self._time_format)
- # ==========================================
- # Color and size of Y1 axis ticks and labels
- ax1.set_title(self._title, fontsize=18)
- ax1.set_ylabel(self.variable, color='k', fontsize=14)
- ax1.tick_params(axis='y', colors='k')
- # Tick labels are displayed as numbers until they reach -100:100 range.
- # Then ticks are displayed as 10 exponential shown above plot corner
- ax1.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
- for label in (ax1.get_yticklabels()):
- label.set_fontname('Arial')
- label.set_fontsize(12)
- # AX1 grid line setting
- ax1.xaxis.set_minor_locator(AutoMinorLocator())
- ax1.grid(b=True, which='both', color='k')
- ax1.margins(y=0.2) # gives space between plot edges and data min, max
- # ==========================================
- # AX2
- # ==========================================
- ax2.set_ylabel('abs(delta)', color='k', fontsize=14)
- ax2.tick_params(axis='y', colors='k')
- ax2.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
- for label in (ax2.get_yticklabels()):
- label.set_fontname('Arial')
- label.set_fontsize(12)
- # AX2 grid setting
- ax2.xaxis.set_minor_locator(AutoMinorLocator())
- ax2.grid(b=True, which='both', color='k')
- ax2.margins(y=0.2)
- # ==========================================
- # AX3
- # ==========================================
- ax3.set_title('Data histogram')
- ax3.set_ylabel('Frequency', color='k', fontsize=14)
- ax3.set_xlabel("Discrepancy size", fontsize=10)
- ax3.tick_params(axis='y', colors='k')
- ax3.ticklabel_format(axis='x', style='sci', scilimits=(0, 0))
- ax3.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
- for label in (ax3.get_yticklabels()):
- label.set_fontname('Arial')
- label.set_fontsize(10)
- # AX3 grid setting
- ax3.xaxis.set_minor_locator(AutoMinorLocator())
- ax3.grid(which='major', color='k')
- ax3.margins(y=0.2)
- # ==========================================
- # AX4
- # ==========================================
- ax4.set_title('Data Box plot')
- ax4.set_ylabel(self.variable, fontsize=10)
- ax4.tick_params(axis='y', colors='k')
- ax4.ticklabel_format(axis='x', style='sci', scilimits=(0, 0))
- ax4.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
- for label in (ax4.get_yticklabels()):
- label.set_fontname('Arial')
- label.set_fontsize(10)
- # AX4 grid setting
- ax4.xaxis.set_minor_locator(AutoMinorLocator())
- ax4.grid(which='major', color='k')
- ax4.margins(y=0.2)
- # ==========================================
- # AX5
- # ==========================================
- ax5.set_title('abs(delta) histogram')
- ax5.set_xlabel("Discrepancy size", fontsize=11)
- ax5.tick_params(axis='y', colors='k')
- ax5.ticklabel_format(axis='x', style='sci', scilimits=(0, 0))
- ax5.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
- for label in (ax5.get_yticklabels()):
- label.set_fontname('Arial')
- label.set_fontsize(10)
- # AX5 grid setting
- ax5.xaxis.set_minor_locator(AutoMinorLocator())
- ax5.grid(which='major', color='k')
- ax5.margins(y=0.2)
- # ==========================================
- # ==========================================
- # ax1.set_xticklabels([])
- # gs.tight_layout(figure)
- figure.tight_layout()
- return figure, ax1, ax2, ax3, ax4, ax5
Advertisement
Add Comment
Please, Sign In to add comment