def _create_plot(i, name, data, counter_two): # Step the color on all subplots no just on plots # within the same axis/subplot # this is to match the qcodes-pyqtplot behaviour. title = "{} #{:03d}".format(CURRENT_EXPERIMENT["sample_name"], data.location_provider.counter) rasterized_note = " rasterized plot full data available in datafile" color = 'C' + str(counter_two) counter_two += 1 plot = MatPlot() inst_meas_name = "{}_{}".format(i._instrument.name, name) inst_meas_data = getattr(data, inst_meas_name) inst_meta_data = __get_plot_type(inst_meas_data, plot) if 'z' in inst_meta_data: xlen, ylen = inst_meta_data['z'].shape rasterized = xlen * ylen > 5000 plot.add(inst_meas_data, rasterized=rasterized) else: rasterized = False plot.add(inst_meas_data, color=color) plot.subplots[0].grid() if rasterized: plot.subplots[0].set_title(title + rasterized_note) else: plot.subplots[0].set_title(title) plot.save("{}_{:03d}.pdf".format(plot.get_default_title(), counter_two)) plot.fig.canvas.draw()
def _create_plot(i, name, data, counter_two, display_plot=True): # Step the color on all subplots no just on plots # within the same axis/subplot # this is to match the qcodes-pyqtplot behaviour. title = "{} #{:03d}".format(CURRENT_EXPERIMENT["sample_name"], data.location_provider.counter) rasterized_note = " rasterized plot full data available in datafile" color = 'C' + str(counter_two) counter_two += 1 plot = MatPlot() if issubclass( i.__class__, MultiChannelInstrumentParameter) or i._instrument is None: inst_meas_name = name else: inst_meas_name = "{}_{}".format(i._instrument.name, name) inst_meas_data = getattr(data, inst_meas_name) try: inst_meas_data = getattr(data, inst_meas_name) except AttributeError: inst_meas_name = "{}{}_0_0".format(i._instrument.name, name) inst_meas_data = getattr(data, inst_meas_name) inst_meta_data = __get_plot_type(inst_meas_data, plot) if 'z' in inst_meta_data: xlen, ylen = inst_meta_data['z'].shape rasterized = xlen * ylen > 5000 po = plot.add(inst_meas_data, rasterized=rasterized) auto_color_scale_from_config(po.colorbar, auto_color_scale, inst_meta_data['z'], cutoff_percentile) else: rasterized = False plot.add(inst_meas_data, color=color) plot.subplots[0].grid() if rasterized: plot.subplots[0].set_title(title + rasterized_note) else: plot.subplots[0].set_title(title) title_list = plot.get_default_title().split(sep) title_list.insert(-1, CURRENT_EXPERIMENT['pdf_subfolder']) title = sep.join(title_list) plot.rescale_axis() plot.tight_layout() plot.save("{}_{:03d}.pdf".format(title, counter_two)) if display_plot: plot.fig.canvas.draw() plt.show() else: plt.close(plot.fig)