def load_graph(self, reader, window_title=''): cg = ContourGraph( container_dict=dict(kind='h', # padding=40, # shape=(2, 2), # spacing=(12, 12) ) ) z, metadata = self._extract_power_map_data(reader) self._data = z self._metadata = metadata center_plot = cg.new_plot( add=False, padding=0, width=400, height=400, resizable='' # aspect_ratio=1 ) center_plot.index_axis.visible = False center_plot.value_axis.visible = False # from skimage.morphology import label # z = label(z) bounds = metadata['bounds'] #center_plot, names, rd = cg.new_series(z=z, style='contour', cg.new_series(z=z, style='contour', xbounds=bounds, ybounds=bounds, ) bottom_plot = cg.new_plot( add=False, height=150, resizable='h', padding=0, xtitle='mm', ytitle='power') right_plot = cg.new_plot( add=False, width=150, resizable='v', padding=0, xtitle='mm', ytitle='power') right_plot.x_axis.orientation = 'right' # right_plot.x_axis.title = 'mm' right_plot.y_axis.orientation = 'top' # right_plot.y_axis.title = 'power' center = center_plot.plots['plot0'][0] options = dict(style='cmap_scatter', type='cmap_scatter', marker='circle', color_mapper=center.color_mapper) cg.new_series(plotid=1, render_style='connectedpoints') cg.new_series(plotid=1, **options) right_plot.x_axis.orientation = 'right' right_plot.y_axis.orientation = 'top' right_plot.x_axis.mapper = center_plot.value_mapper right_plot.y_axis.mapper = bottom_plot.value_mapper right_plot.x_axis.axis_line_visible = False right_plot.y_axis.axis_line_visible = False s = cg.new_series(plotid=2, render_style='connectedpoints')[0] s.orientation = 'v' s = cg.new_series(plotid=2, **options)[0] s.orientation = 'v' center.index.on_trait_change(cg.metadata_changed, 'metadata_changed') cg.show_crosshairs('blue') # z = self._plot_properties(z, metadata, cg) # cg.plots[0].data.set_data('z0', z) gridcontainer = cg._container_factory(kind='g', padding=40, shape=(2, 2), spacing=(12, 12)) gridcontainer.add(center_plot) gridcontainer.add(right_plot) gridcontainer.add(bottom_plot) cb = cg.make_colorbar(center) cb.width = 50 cb.padding_left = 50 cg.plotcontainer.add(cb) cg.plotcontainer.add(gridcontainer) self.graph = cg return cg
def load_graph(self, reader, window_title=''): cg = ContourGraph(container_dict=dict( kind='h', # padding=40, # shape=(2, 2), # spacing=(12, 12) )) z, metadata = self._extract_power_map_data(reader) self._data = z self._metadata = metadata center_plot = cg.new_plot(add=False, padding=0, width=400, height=400, resizable='' # aspect_ratio=1 ) center_plot.index_axis.visible = False center_plot.value_axis.visible = False # from skimage.morphology import label # z = label(z) bounds = metadata['bounds'] #center_plot, names, rd = cg.new_series(z=z, style='contour', cg.new_series( z=z, style='contour', xbounds=bounds, ybounds=bounds, ) bottom_plot = cg.new_plot(add=False, height=150, resizable='h', padding=0, xtitle='mm', ytitle='power') right_plot = cg.new_plot(add=False, width=150, resizable='v', padding=0, xtitle='mm', ytitle='power') right_plot.x_axis.orientation = 'right' # right_plot.x_axis.title = 'mm' right_plot.y_axis.orientation = 'top' # right_plot.y_axis.title = 'power' center = center_plot.plots['plot0'][0] options = dict(style='cmap_scatter', type='cmap_scatter', marker='circle', color_mapper=center.color_mapper) cg.new_series(plotid=1, render_style='connectedpoints') cg.new_series(plotid=1, **options) right_plot.x_axis.orientation = 'right' right_plot.y_axis.orientation = 'top' right_plot.x_axis.mapper = center_plot.value_mapper right_plot.y_axis.mapper = bottom_plot.value_mapper right_plot.x_axis.axis_line_visible = False right_plot.y_axis.axis_line_visible = False s = cg.new_series(plotid=2, render_style='connectedpoints')[0] s.orientation = 'v' s = cg.new_series(plotid=2, **options)[0] s.orientation = 'v' center.index.on_trait_change(cg.metadata_changed, 'metadata_changed') cg.show_crosshairs('blue') # z = self._plot_properties(z, metadata, cg) # cg.plots[0].data.set_data('z0', z) gridcontainer = cg._container_factory(kind='g', padding=40, shape=(2, 2), spacing=(12, 12)) gridcontainer.add(center_plot) gridcontainer.add(right_plot) gridcontainer.add(bottom_plot) cb = cg.make_colorbar(center) cb.width = 50 cb.padding_left = 50 cg.plotcontainer.add(cb) cg.plotcontainer.add(gridcontainer) self.graph = cg return cg