Re: [pyqtgraph] I would like to show more number of yTick values. But could not find any solution so far.

19 views
Skip to first unread message
Message has been deleted

Jerzy Karczmarczuk

unread,
May 6, 2020, 9:21:03 AM5/6/20
to pyqt...@googlegroups.com

Le 06/05/2020 à 14:11, Syed Imtiaz Ali Shah a écrit :

As can be seen in this picture, the current value of the plot seems to be 30 but even this value is not shown. I have set Y limit to (0,100). I would like to show at least every thrid value on Y-Axis. 

For example [0,3,6,9,12............100]

I will appreciate your help.

I would appreciate if you could show your program, instead of just a plot without any details.
You say: "could not find any solution so far". Did you really try? I suspect that you  prefer to ask for help instead of reading the manual, and all kind of tutorial-like examples on the Web.

You would find AxisItems, setTicks, and other useful goodies. OK, try this, somewhat senseless:

import numpy as np
import pyqtgraph as pg

dta=np.linspace(0,1,200)
gr=pg.plot(dta,pen='r')
gr.setYRange(-1.2,1.2)


axy = gr.getAxis('left')
yticks = [-1,0,0.3,0.8,1.2] # or more dense if you wish
axy.setTicks([[(p, str(p)) for p in yticks ]])

Adapt this to your needs. Good bye.

Jerzy Karczmarczuk
/Caen, France/


Message has been deleted

Syed Imtiaz Ali Shah

unread,
May 6, 2020, 9:35:36 AM5/6/20
to pyqtgraph
I have tried this already, but lets try it again with different approach.

Anyway thank you 😊
Reply all
Reply to author
Forward
0 new messages