x and y axis starting point is far apart

35 views
Skip to first unread message

bobtoong

unread,
Sep 17, 2022, 3:32:21 AM9/17/22
to pyqtgraph
Hi there,
I'm in trouble two axes are apart from each other.

Please check it and let me know.

pygraph.jpg

And the code is below.

# layout
w = pg.PlotWidget(title='Basic Plot')
self.vl_Graph.addWidget(w)

# data
x = [0, 1, 2, 3, 4]
y = [0, 1, 2, 3, 4]

# style
w.setBackground('w')
w.setTitle('Title')
w.setLabel('left', 'y-axis')
w.setLabel('bottom', 'x-axis')
w.showGrid(x=True, y=True)
w.addLegend()
# w.setXRange(0, 10, padding=0)

# plot
w.plot(x, y, pen=pg.mkPen('r'), name='default plot', skipFiniteCheck=True)

Thanks.

Martin Chase

unread,
Sep 17, 2022, 12:56:53 PM9/17/22
to pyqt...@googlegroups.com
Heya,

I could not reproduce the behavior you described. Your code didn't work as-is; I changed the "layout" section to just be `w = pg.plot(title="Basic Plot")`, and I added a `pg.exec()` at the end, but I don't think either of those would have had an impact. What does the `self` at the beginning refer to? That's likely a necessary part of reproducing your problem. Can you post the rest of this class?

Best,
 - Martin (he/him)

--
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 pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/123c5804-610a-41e2-9b34-e64d7187222fn%40googlegroups.com.

bobtoong

unread,
Sep 17, 2022, 9:44:56 PM9/17/22
to pyqtgraph
Hi Martin,

I pushed the whole code to githup.
Please check it.


Thanks.
Yeon.

2022년 9월 18일 일요일 오전 1시 56분 53초 UTC+9에 outofc...@gmail.com님이 작성:

Martin Chase

unread,
Sep 18, 2022, 1:56:21 AM9/18/22
to pyqt...@googlegroups.com
Hey Yeon,

Your git project displays its axes fine for me:

MainWindow_001.png
Maybe you need to upgrade your pyqt or other libraries? Maybe run the pyqtgraph examples ( `python -m pyqtgraph.examples` ), and see if anything else is having problems.

Good luck,
 - Martin (he/him)

bobtoong

unread,
Sep 18, 2022, 6:50:12 AM9/18/22
to pyqtgraph
Hi Martin,

Thank you for your help.
I'll check it again.

Regard.
Yeon.

2022년 9월 18일 일요일 오후 2시 56분 21초 UTC+9에 outofc...@gmail.com님이 작성:
Reply all
Reply to author
Forward
0 new messages