def draw(self): if not self._draw_graphics: return x = range(0, 128) y = range(0, 128) z = readfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "kws.dat"), separator="$") zrange = max(z) - min(z) h = [min(z) + i * 0.025 * zrange for i in range(0, 40)] gr.setviewport(0.075, 0.95, 0.075, 0.95) gr.setwindow(1, 128, 1, 128) gr.setspace(min(z), max(z), 0, 90) gr.setcharheight(0.018) gr.setcolormap(-3) gr.surface(x, y, z, 5) gr.contour(x, y, h, z, -1) gr.axes(5, 5, 1, 1, 2, 2, 0.0075)
def draw(self): if not self._draw_graphics: return x = range(0, 128) y = range(0, 128) z = readfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "kws.dat"), separator='$') zrange = max(z) - min(z) h = [min(z) + i * 0.025 * zrange for i in range(0, 40)] gr.setviewport(0.075, 0.95, 0.075, 0.95) gr.setwindow(1, 128, 1, 128) gr.setspace(min(z), max(z), 0, 90) gr.setcharheight(0.018) gr.setcolormap(-3) gr.surface(x, y, z, 5) gr.contour(x, y, h, z, -1) gr.axes(5, 5, 1, 1, 2, 2, 0.0075)
def main(*args): app = QtWidgets.QApplication(*args) grw = InteractiveGRWidget() viewport = [0.1, 0.88, 0.1, 0.88] z = readfile( os.path.join(os.path.dirname(os.path.realpath(__file__)), "fecr.dat")) zd = np.asarray(z) xd = yd = np.arange(1, 201) axes = ContourAxes(viewport) axes.addCurves(PlotSurface(xd, yd, zd, option=gr.OPTION_CELL_ARRAY)) axes.addCurves(PlotContour(xd, yd, zd)) axes.setGrid(False) plot = Plot(viewport).addAxes(axes) plot.title = "Plot surface and contour lines using QtGR" grw.addPlot(plot) grw.resize(QtCore.QSize(500, 500)) grw.show() win = axes.getWindow() grw.update() sys.exit(app.exec_())
def main(*args): app = QtGui.QApplication(*args) grw = InteractiveGRWidget() viewport = [0.1, 0.88, 0.1, 0.88] z = readfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "fecr.dat")) zd = np.asarray(z) xd = yd = np.arange(1, 201) axes = ContourAxes(viewport) axes.addCurves(PlotSurface(xd, yd, zd, option=gr.OPTION_CELL_ARRAY)) axes.addCurves(PlotContour(xd, yd, zd)) axes.setGrid(False) plot = Plot(viewport).addAxes(axes) plot.title = "Plot surface and contour lines using QtGR" grw.addPlot(plot) grw.resize(QtCore.QSize(500, 500)) grw.show() win = axes.getWindow() grw.update() sys.exit(app.exec_())