Пример #1
0
 def _plot_default(self):
     plot = Plot(self.plot_data)
     plot.x_axis = None
     plot.y_axis = None
     plot.x_grid = None
     plot.y_grid = None
     plot.padding = 0
     plot.plot(('x', 'image_histogram'), render_style='connectedhold')
     plot.plot(('x', 'mapped_histogram'), type='filled_line', fill_color='yellow',
         render_style='connectedhold', name='mapped_histogram')
     intercept_tool = AttributeDragTool(component=plot, model=self.unit_map,
             x_attr='intercept')
     slope_tool = AttributeDragTool(component=plot, model=self.unit_map,
             x_attr='slope', modifier_keys=set(['shift']))
     gamma_tool = AttributeDragTool(component=plot, model=self.unit_map,
             x_attr='gamma', modifier_keys=set(['control']))
     plot.tools += [intercept_tool, slope_tool, gamma_tool]
     intercept_overlay =  SimpleInspectorOverlay(component=plot, align='ul',
             inspector=intercept_tool,
             field_formatters=[[basic_formatter('Intercept', 2)]]
         )  
     slope_overlay =  SimpleInspectorOverlay(component=plot, align='ul',
             inspector=slope_tool,
             field_formatters=[[basic_formatter('Slope', 2)]]
         )  
     gamma_overlay =  SimpleInspectorOverlay(component=plot, align='ul',
             inspector=gamma_tool,
             field_formatters=[[basic_formatter('Gamma', 2)]]
         )  
     plot.overlays += [intercept_overlay, slope_overlay, gamma_overlay]
     return plot
Пример #2
0
 def _plot_default(self):
     plot = Plot(self.plot_data)
     plot.x_axis = None
     plot.y_axis = None
     plot.x_grid = None
     plot.y_grid = None
     plot.padding = 0
     plot.plot('image_histogram')
     plot.plot('mapped_histogram', type='filled_line', fill_color='yellow')
     return plot
Пример #3
0
 def _plot_default(self):
     plot = Plot(self.plot_data)
     plot.x_axis = None
     plot.y_axis = None
     plot.x_grid = None
     plot.y_grid = None
     plot.padding = 0
     plot.plot(('x', 'image_histogram'), render_style='connectedhold')
     plot.plot(('x', 'mapped_histogram'), type='filled_line', fill_color='yellow',
         render_style='connectedhold', name='mapped_histogram')
     intercept_tool = AttributeDragTool(component=plot,
         model=self.unit_map, x_attr='intercept')
     plot.tools.append(intercept_tool)
     return plot
Пример #4
0
 def _TracePlot_default(self):
     plot = Plot(self.TraceData, width=500, height=500, resizable='hv')
     plot.plot(('t', 'y8'),
               type='line',
               line_style='solid',
               color=0xFFFFFF,
               line_width=2,
               render_style='connectedpoints',
               name='ch0 & ch1')
     plot.bgcolor = scheme['background']
     plot.value_range.low = 0.0
     plot.x_grid = None
     plot.y_grid = None
     return plot
Пример #5
0
 def _create_line_plot(self):
     line_data = ArrayPlotData(frequency=np.array((0.,1.)), counts=np.array((0.,0.)), fit=np.array((0.,0.))) 
     line_plot = Plot(line_data, padding=8, padding_left=64, padding_bottom=32)
     line_plot.plot(('frequency','counts'), style='line', color=scheme['data 1'], line_width=2)
     line_plot.bgcolor = scheme['background']
     line_plot.x_grid = None
     line_plot.y_grid = None
     line_plot.index_axis.title = 'Frequency [MHz]'
     line_plot.value_axis.title = 'Fluorescence counts'
     line_plot.value_range.low = 0.0
     line_plot.tools.append(PanTool(line_plot))
     line_plot.overlays.append(SimpleZoom(line_plot, enable_wheel=False))
     self.line_data = line_data
     self.line_plot = line_plot
Пример #6
0
    def _plot_default(self):
        plot = Plot(self.plot_data)
        plot.x_axis = None
        plot.y_axis = None
        plot.x_grid = None
        plot.y_grid = None
        plot.padding = 0
        plot.plot(("x", "image_histogram"), render_style="connectedhold")
        plot.plot(
            ("x", "mapped_histogram"),
            type="filled_line",
            fill_color="yellow",
            render_style="connectedhold",
            name="mapped_histogram",
        )

        low_overlay = AttributeLineOverlay(component=plot, model=self.unit_map, x_attr="low", orientation="vertical")
        high_overlay = AttributeLineOverlay(component=plot, model=self.unit_map, x_attr="high", orientation="vertical")

        intercept_tool = AttributeDragTool(component=plot, model=self.unit_map, x_attr="intercept")
        slope_tool = AttributeDragTool(
            component=plot, model=self.unit_map, x_attr="slope", modifier_keys=set(["shift"])
        )
        gamma_tool = AttributeDragTool(
            component=plot, model=self.unit_map, x_attr="gamma", modifier_keys=set(["control"])
        )
        plot.tools += [intercept_tool, slope_tool, gamma_tool]

        intercept_overlay = SimpleInspectorOverlay(
            component=plot, align="ul", inspector=intercept_tool, field_formatters=[[basic_formatter("Intercept", 2)]]
        )
        slope_overlay = SimpleInspectorOverlay(
            component=plot, align="ul", inspector=slope_tool, field_formatters=[[basic_formatter("Slope", 2)]]
        )
        gamma_overlay = SimpleInspectorOverlay(
            component=plot, align="ul", inspector=gamma_tool, field_formatters=[[basic_formatter("Gamma", 2)]]
        )

        plot.overlays += [intercept_overlay, slope_overlay, gamma_overlay, low_overlay, high_overlay]
        return plot
Пример #7
0
def _create_plot_component():
    army_lat = np.column_stack([army['start_lat'],
                                army['end_lat']]).reshape(-1)
    army_lon = np.column_stack([army['start_lon'],
                                army['end_lon']]).reshape(-1)

    plot_data = ArrayPlotData(
        army_lon=army_lon,
        army_lat=army_lat,
        army_size=army['size'],
        army_color=army['direction'] * army["group"],
        towns_lat=towns['lat'],
        towns_lon=towns['lon'],
        towns=towns['town'],
        temp_lon=temperatures['lon'],
        temp=temperatures['temp'],
        temp_date=temperatures['date'],
    )

    map_plot = Plot(plot_data)
    map_plot.x_grid = None
    map_plot.y_grid = None
    map_plot.x_axis.orientation = 'top'
    map_plot.x_axis.title = 'Longitude'
    map_plot.y_axis.title = 'Latitude'
    map_plot.title = "Minard's Map of Napoleon's Russian Campaign"
    map_plot._title.overlay_position = "inside top"
    map_plot._title.hjustify = "left"
    map_plot._title.vjustify = "bottom"
    map_plot.plot(
        ("army_lon", "army_lat", "army_color", "army_size"),
        type="cmap_segment",
        name="my_plot",
        color_mapper=viridis,
        border_visible=True,
        bgcolor="white",
        size_min=1.0,
        size_max=128.0,
    )
    map_plot.plot(
        ("towns_lon", "towns_lat"),
        type="scatter",
    )
    map_plot.plot(
        ("towns_lon", "towns_lat", "towns"),
        type="text",
        text_margin=4,
        h_position='right',
        text_offset=(4, 0),
    )
    map_plot.plot_1d(
        ('temp_lon'),
        type='line_scatter_1d',
        alpha=0.5,
        line_style='dot',
    )
    map_plot.index_range.high_setting = 38
    map_plot.index_range.low_setting = 23
    map_plot.value_range.high_setting = 56.0
    map_plot.value_range.low_setting = 53.5
    map_plot.tools.extend([
        PanTool(map_plot),
        ZoomTool(map_plot),
    ])

    temp_plot = Plot(plot_data, height=100)
    temp_plot.index_range = map_plot.index_range
    temp_plot.x_grid = None
    temp_plot.x_axis = None
    temp_plot.y_axis.orientation = 'right'
    temp_plot.y_axis.title = u'Temp (°Re)'
    temp_plot.plot(
        ('temp_lon', 'temp'),
        type='line',
    )
    temp_plot.plot_1d(
        ('temp_lon'),
        type='line_scatter_1d',
        alpha=0.5,
        line_style='dot',
    )
    temp_plot.plot_1d(
        ('temp_lon', 'temp_date'),
        type='textplot_1d',
        alpha=0.5,
        line_style='dot',
        alignment='bottom',
    )
    temp_plot.value_range.high_setting = 5
    temp_plot.value_range.low_setting = -35

    container = VPlotContainer(temp_plot, map_plot)
    container.spacing = 0
    map_plot.padding_bottom = 0
    map_plot.padding_left = 70
    map_plot.padding_right = 70
    map_plot.padding_top = 50
    temp_plot.padding_top = 0
    temp_plot.padding_bottom = 15
    temp_plot.padding_right = 70
    temp_plot.padding_left = 70
    temp_plot.height = 100
    temp_plot.resizable = 'h'

    return container