Commit fcb9d140 authored by Lucas Giardino's avatar Lucas Giardino

agrego opcion de ancho de bin en applet histogram

parent bab947dc
...@@ -19,11 +19,17 @@ class MakeHistogramAndPlot(pyqtgraph.PlotWidget): ...@@ -19,11 +19,17 @@ class MakeHistogramAndPlot(pyqtgraph.PlotWidget):
y = y[~np.isnan(y)] y = y[~np.isnan(y)]
#print(self.args.x) #print(self.args.x)
#if len(y[~np.isnan(y)]) > 5: return #if len(y[~np.isnan(y)]) > 5: return
if self.args.x is None: if self.args.x is None:
x = 'auto' if self.args.binw is None:
x = 'auto'
else:
binw = float(self.args.binw)
x = np.arange(y.min(), y.max()+2*binw, binw)
else: else:
x = data[self.args.x][1] x = data[self.args.x][1]
except KeyError: except KeyError as e:
raise e
return return
# This makes the histogram with the full datasets # This makes the histogram with the full datasets
...@@ -39,7 +45,9 @@ class MakeHistogramAndPlot(pyqtgraph.PlotWidget): ...@@ -39,7 +45,9 @@ class MakeHistogramAndPlot(pyqtgraph.PlotWidget):
def main(): def main():
applet = TitleApplet(MakeHistogramAndPlot) applet = TitleApplet(MakeHistogramAndPlot)
applet.add_dataset("y", "Y values") applet.add_dataset("y", "Y values")
applet.add_dataset("binw", "Bin widths", required=False)
applet.add_dataset("x", "Bin boundaries", required=False) applet.add_dataset("x", "Bin boundaries", required=False)
# applet.add_dataset("binw", "Bin widths", required=False)
applet.run() applet.run()
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment