plotwidget¶
Plot widget
- class tuiview.plotwidget.PlotBarWidget(*args: Any, **kwargs: Any)[source]¶
Widget for making bar plots
- getXDataRange()[source]¶
Get the range of the X data to be plotted. If value(s) have been set with SetXRange these are returned
- getYDataRange()[source]¶
Get the range of the Y data to be plotted. If value(s) have been set with SetYRange these are returned
- class tuiview.plotwidget.PlotBars(data, minVal, maxVal, pen=None, fillColor=PyQt5.QtCore.Qt.white)[source]¶
Pass an instance of this to PlotBarWidget.setBars() data should be a numpy array containing the counts. minVal and maxVal describe the range of the data
- class tuiview.plotwidget.PlotCurve(xdata, ydata, pen=None)[source]¶
Pass instances of these to PlotLineWidget.addCurve() xdata and ydata should be numpy arrays If pen not given will be white, 1 pixel wide
- class tuiview.plotwidget.PlotLabel(xloc, yloc, txt, flags=0, pen=None)[source]¶
Pass instances of these to PlotWidget.addLabel() xloc and yloc are in data units txt is text to display flags are those accepted by QPainter.drawText If pen not given will be white, 1 pixel wide
- class tuiview.plotwidget.PlotLineWidget(*args: Any, **kwargs: Any)[source]¶
Widget for making line plots
- getXDataRange()[source]¶
Get the range of the X data to be plotted. If value(s) have been set with SetXRange these are returned
- getYDataRange()[source]¶
Get the range of the Y data to be plotted. If value(s) have been set with SetYRange these are returned
- class tuiview.plotwidget.PlotTick(loc, txt, flags=None, pen=None)[source]¶
Pass lists of these to PlotWidget.setXTicks and PlotWidget.setYTicks if flags is None either DEFAULT_YTICK_FLAGS or DEFAULT_XTICK_FLAGS will be used depending on the direction if pen is None the default axes pen will be used
- class tuiview.plotwidget.PlotWidget(*args: Any, **kwargs: Any)[source]¶
Lightweight plot widget base class Don’t instantiate directly - use one of the base classes.
- drawLabels(paint, minXData, minYData, xoffset, xscale, yoffset, yscale)[source]¶
Draw the user supplied labels onto the plot
- drawText(paint, xloc, yloc, txt, flags)[source]¶
Helper method to draw text in given device coords For some reason Qt doesn’t come with a method like this that moves the text around for given flags.
- drawYTicks(paint, minYData, maxYData, yoffset, yscale, height)[source]¶
Draw the Y-ticks. Returns the size needed for the text
- static makeIntervals(start, end, nIntervals)[source]¶
Make a ‘pretty’ list of intervals. This was the hardest part. also returns number of decimals to display This is non-zero if floating point data
- paintEvent(event)[source]¶
This is the main part - calculation and drawing happen here. In theory the calculation should happen separately on resize etc and paint should be simpler, but can’t be bothered right now Delegates to paintData() in sublass to do actuall work
- setXRange(xmin=None, xmax=None)[source]¶
Set the X range. Pass None for autoscale for either or both