def save_svg(self, filename): self._invert_color() previous_label = None if self.spectrum_plot.getAxis('bottom').labelText == u'2θ': previous_label = (u'2θ', '°') self.spectrum_plot.setLabel('bottom', '2th_deg', '') exporter = SVGExporter(self.spectrum_plot) exporter.export(filename) self._norm_color() if previous_label is not None: self.spectrum_plot.setLabel('bottom', previous_label[0], previous_label[1])
def save_svg(self, filename): self._invert_color() previous_label = None if self.pattern_plot.getAxis('bottom').labelText == u'2θ': previous_label = (u'2θ', '°') self.pattern_plot.setLabel('bottom', '2th_deg', '') exporter = SVGExporter(self.pattern_plot) exporter.export(filename) self._norm_color() if previous_label is not None: self.pattern_plot.setLabel('bottom', previous_label[0], previous_label[1])
def save_svg(self, filename): self.invert_color() exporter = SVGExporter(self.spectrum_plot) exporter.export(filename) self.norm_color()
# -*- coding: utf8 -*- __author__ = 'Clemens Prescher' import pyqtgraph as pg from pyqtgraph.exporters.SVGExporter import SVGExporter from PyQt4 import QtGui if __name__ == '__main__': app = QtGui.QApplication([]) win = pg.GraphicsWindow("title SVG Exporter bug") win.resize(1000, 600) p1 = win.addPlot() p1.plot(x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], y=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], pen=(200, 200, 200), symbolBrush=(255, 0, 0), symbolPen='w') QtGui.QApplication.processEvents() QtGui.QApplication.processEvents() exporter = SVGExporter(p1) exporter.export("test.svg")
if __name__ == '__main__': app = QtGui.QApplication([]) win = pg.GraphicsWindow("PNG export") win.resize(1000, 600) p1 = win.addPlot() p1.plot(x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], y=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) scatter = pg.ScatterPlotItem( pen=(200, 200, 200), symbolBrush=(255, 0, 0), symbolPen='w', size=5, ) p1.addItem(scatter) scatter.setData(np.arange(10), np.arange(10)) QtGui.QApplication.processEvents() QtGui.QApplication.processEvents() ''' pngexp = ImageExporter(p1) pngexp.params["width"] = int(pngexp.params["width"]) pngexp.export("176.png") pngexp = ImageExporter(p1) pngexp.params["width"] = int(pngexp.params["width"] * 3) pngexp.export("176_scaled.png") ''' svgexp = SVGExporter(p1) svgexp.export("176.svg")