When data is plotted there is a padding between the first and last x points 
by default.
For example, when I plot using the following, the first x axis value is 
approximately 1e-3 rather than 0.
How can I plot the data so that xmin and xmax on the x axis correspond to 
xmin and xmax of the plotted data? Do I have to manually set the x limits 
or is there a setting for this?


from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import pyqtgraph as pg
import numpy as np
import sys


class PlotWidget(pg.GraphicsLayoutWidget):
    
    def __init__(self):
        super().__init__()
        self.myplot = self.addPlot()
        self.viewbox = self.myplot.getViewBox() #correct method
        self.myplot.showGrid(True,True, 1)
        
        x = np.linspace(0,20e-3, 100)
        y = 2*np.sin(2*np.pi*50*x)
        curve = self.myplot.plot(x, y)
        self.show()
        
if __name__ == '__main__':
    app = QApplication(sys.argv)
    plot = PlotWidget()
    sys.exit(app.exec_())


-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/60271c6a-3a50-43a3-9624-bfa839f92c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to