def make_1d(widget, data): """Created the 1 dimensional widgets :param widget: the PyQt5 widget :param data: the data the Users wants to show :return: the PyQt5 widget """ fig, ax = plt.subplots() plt.plot(data) plt.xlabel(' ') plt.tight_layout(pad=2) widget = FigureCanvas(fig) widget.fig = fig widget.ax = ax return widget
def make_2d(widget, image, types='norm'): """Creates the first 2D plots :param widget: the PyQt5 widget you are trying to make a plot for :param image: the image you want to show :param types: the type of image - sets the image title :return: the PyQt5 Completed widget """ fig, ax = plt.subplots() plt.imshow(image) if types == 'norm': plt.axis('off') plt.tight_layout() elif types == 'ttheta': plt.axis('off') plt.tight_layout() elif types == 'chi': plt.axis('off') plt.tight_layout() elif types == 'spot_dif': plt.title('Spot Diffraction', fontsize=8) plt.tight_layout(pad=3) elif types == 'sum_dif': plt.title('Sum. Diffraction', fontsize=8) plt.tight_layout(pad=3) widget = FigureCanvas(fig) widget.fig = fig widget.ax = ax return widget