Axis label and units prefixes

2,455 views
Skip to first unread message

Leonid Rumatov

unread,
Jun 5, 2013, 12:56:35 AM6/5/13
to pyqt...@googlegroups.com
Here is my wish.
It's not urgent, but, I think, everybody need this.

We can set label to the axis, including measure units.
And, the pyqtgraph itself choose prefix for the units - 'k', 'm' (means - 'kilo', 'mega') and so on.
But, if the library do so, then tick labels on the axis (that show numbers) have ti be divided to this koefficient.
If axis choose prefix 'kilo', tick labels shoud be divided by 1000, if axis choose 'mega' - to 1000 000.

Now I can do this myself, but, I think, that will be correct.

Luke Campagnola

unread,
Jun 5, 2013, 1:01:40 AM6/5/13
to pyqt...@googlegroups.com
On Wed, Jun 5, 2013 at 12:56 AM, Leonid Rumatov <dondu...@yandex.ru> wrote:
Here is my wish.
It's not urgent, but, I think, everybody need this.

We can set label to the axis, including measure units.
And, the pyqtgraph itself choose prefix for the units - 'k', 'm' (means - 'kilo', 'mega') and so on.
But, if the library do so, then tick labels on the axis (that show numbers) have ti be divided to this koefficient.
If axis choose prefix 'kilo', tick labels shoud be divided by 1000, if axis choose 'mega' - to 1000 000.


I think what you are describing is already the default behavior if you specify units for an axis. For example:

    plot.setLabels(left=('axis title', 'm'))   # scaling will automatically add SI prefix
 

Слава

unread,
Jun 5, 2013, 1:32:25 AM6/5/13
to Luke Campagnola
Hello, Luke.

Yes, you right, that was my mistake.
> wrote:
-- 
-- [ You are subscribed to pyqt...@googlegroups.com. To unsubscribe, send email to pyqtgraph+...@googlegroups.com ]
--- 
You received this message because you are subscribed to a topic in the Google Groups "pyqtgraph" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/pyqtgraph/UiYWvbKVOo8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to pyqtgraph+...@googlegroups.com.
For more options, visit 
https://groups.google.com/groups/opt_out.
 
 



-- 
Best wishes!
 Слава                            
mailto:dondu...@yandex.ru

Leonid Rumatov

unread,
Jun 10, 2013, 1:36:02 AM6/10/13
to pyqt...@googlegroups.com
Small linked question.
How can I turn off coefficient on the axis label?
Coefficient != 1.

среда, 5 июня 2013 г., 11:01:40 UTC+6 пользователь Luke Campagnola написал:

Luke Campagnola

unread,
Jun 10, 2013, 7:36:08 AM6/10/13
to pyqt...@googlegroups.com
On Mon, Jun 10, 2013 at 1:36 AM, Leonid Rumatov <dondu...@yandex.ru> wrote:
Small linked question.
How can I turn off coefficient on the axis label?
Coefficient != 1.

I think AxisItem.setScale is what you want:

    plot.getAxis('bottom').setScale(1)  


 
--
-- [ You are subscribed to pyqt...@googlegroups.com. To unsubscribe, send email to pyqtgraph+...@googlegroups.com ]
---
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.

Ajay Rathore

unread,
Oct 7, 2016, 4:49:29 AM10/7/16
to pyqtgraph

Hi Luke,
a small question. I am using plotitem and the x axis shows 'ks' kilo second, which I don't want. I want my axis to show 1000(s) after 900(s) instead of 1(ks). How do I disable this thing.
Do I have to change something here?
p1.setLable('bottom', "Time", units = 's')
Reply all
Reply to author
Forward
0 new messages