Exemplo n.º 1
0
 def update_plot_data(self, plots, x_vals, y_vals, new_fmts, old_fmts):
     inflated_args = arg_inflate_tuple(1, check_data(x_vals),
                                       check_data(y_vals), new_fmts)
     for index, (plot, data_tup,
                 old_fmt) in enumerate(zip(plots, inflated_args, old_fmts)):
         x_val, y_val, new_fmt = data_tup
         plot.set_data(x_val, y_val)
         if new_fmt != old_fmt:
             # parse the format string
             linestyle, marker, color = _process_plot_format(new_fmt)
             linestyle = linestyle or rcParams['lines.linestyle']
             marker = marker or rcParams['lines.marker']
             color = color or rcParams['lines.color']
             plot.set_linestyle(linestyle)
             plot.set_marker(marker)
             plot.set_color(color)
             old_fmts[index] = new_fmt
Exemplo n.º 2
0
 def __init__(self, init_plot, framegen, info, rate=1, **kwargs):
     super(XYPlotClient, self).__init__(init_plot, framegen, info, rate,
                                        **kwargs)
     self.plots = []
     self.formats = []
     self.add_legend(init_plot.leg_label, init_plot.leg_offset)
     inflated_args = arg_inflate_tuple(1, check_data(init_plot.xdata),
                                       check_data(init_plot.ydata),
                                       init_plot.formats,
                                       init_plot.leg_label)
     for xdata, ydata, format_val, legend in inflated_args:
         cval = len(self.plots)
         self.formats.append((format_val, cval))
         self.plots.append(
             self.plot_view.plot(x=xdata,
                                 y=ydata,
                                 name=config.PYQT_LEGEND_FORMAT % legend,
                                 **parse_fmt_xyplot(format_val, cval)))
Exemplo n.º 3
0
    def fill(self, corrected_bins, values, fills):
        """
        Adds fill for each histogram based on the boolean 'fills' parameter passed
        with the datagram.

        Takes correct bins (single or list of), histogram values (single or list of),
        and fill configs (single or list of).
        """
        inflated_args = arg_inflate_tuple(3, check_data(corrected_bins),
                                          check_data(values), fills,
                                          self.hists)
        for bin, val, fill, hist in inflated_args:
            if fill:
                self.ax.fill_between(bin,
                                     0,
                                     val,
                                     color=hist.get_color(),
                                     alpha=config.MPL_HIST_ALPHA)
Exemplo n.º 4
0
 def update_sub(self, data):
     """
     Updates the data in the plot - none means their was no update for this interval
     """
     if data is not None:
         inflated_args = arg_inflate_tuple(1, check_data(data.xdata),
                                           check_data(data.ydata),
                                           data.formats)
         for index, (plot, data_tup, format_tup) in enumerate(
                 zip(self.plots, inflated_args, self.formats)):
             xdata, ydata, new_format = data_tup
             old_format, cval = format_tup
             if new_format != old_format:
                 self.formats[index] = (new_format, cval)
                 plot.setData(x=xdata,
                              y=ydata,
                              **parse_fmt_xyplot(new_format, cval))
             else:
                 plot.setData(x=xdata, y=ydata)
     return self.plots
Exemplo n.º 5
0
 def update_sub(self, data):
     """
     Updates the data in the histogram - none means their was no update for this interval
     """
     if data is not None:
         inflated_args = arg_inflate_tuple(1, check_data(data.bins),
                                           check_data(data.values),
                                           data.formats, data.fills)
         for index, (hist, data_tup, format_tup) in enumerate(
                 zip(self.hists, inflated_args, self.formats)):
             bins, values, new_format, new_fill = data_tup
             old_format, old_fill, cval = format_tup
             if new_format != old_format or new_fill != old_fill:
                 fillLevel = 0 if new_fill else None
                 self.formats[index] = (new_format, new_fill, cval)
                 hist.setData(x=bins,
                              y=values,
                              fillLevel=fillLevel,
                              **parse_fmt_hist(new_format, new_fill, cval))
             else:
                 hist.setData(x=bins, y=values)
     return self.hists
Exemplo n.º 6
0
 def __init__(self, init_hist, framegen, info, rate=1, **kwargs):
     super(HistClient, self).__init__(init_hist, framegen, info, rate,
                                      **kwargs)
     self.hists = []
     self.formats = []
     self.add_legend(init_hist.leg_label, init_hist.leg_offset)
     inflated_args = arg_inflate_tuple(1, check_data(init_hist.bins),
                                       check_data(init_hist.values),
                                       init_hist.formats, init_hist.fills,
                                       init_hist.leg_label)
     for bins, values, format_val, fill_val, legend in inflated_args:
         cval = len(self.hists)
         fillLevel = 0 if fill_val else None
         self.formats.append((format_val, fill_val, cval))
         self.hists.append(
             self.plot_view.plot(x=bins,
                                 y=values,
                                 name=config.PYQT_LEGEND_FORMAT % legend,
                                 stepMode=True,
                                 fillLevel=fillLevel,
                                 **parse_fmt_hist(format_val, fill_val,
                                                  cval)))