qdsfit/ui/ExtraDifferentialWidget.py
2014-09-24 21:32:58 +02:00

32 lines
1.2 KiB
Python

# -*- encoding: utf-8 -*-
from ui import ExtraDifferential
__author__ = 'markusro'
from PyQt4.QtGui import QColor
import pyqtgraph as pg
import numpy as np
class DifferentialWidget(ExtraDifferential.PlotWidget):
def __init__(self, parent=None):
super(DifferentialWidget, self).__init__(parent)
self.setLogMode(x=True, y=False)
self.showGrid(x=True, y=True)
self.addLegend()
self.disableAutoRange()
self.setLabel("bottom", "Frequency", units="Hz")
self.setLabel("left", u"Dielectric loss ε<sub>der</sub>''= ∂ε'/∂log10(v)" , units="Debye")
self.curve_imag = pg.PlotDataItem(x=[np.nan], y=[np.nan],pen=QColor(0,0,0,0), symbol='o',
symbolBrush=(255,127,0,127), name=u"Imaginary ε")
self.curve_real = pg.PlotDataItem(x=[np.nan], y=[np.nan],pen=QColor(0,0,0,0), symbol='s',
symbolBrush=(119,202,92,127), name=u"Real ε")
self.addItem(self.curve_imag)
self.addItem(self.curve_real)
def plot(self, x,real_y,imag_y):
self.enableAutoRange()
self.curve_real.setData(x, real_y)
self.curve_imag.setData(x, imag_y)