Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2936 > unrolled thread

howto remove numbers after DOT

Started bySyed Jahanzaib <aacable79@gmail.com>
First post2015-06-16 05:03 -0700
Last post2015-06-22 22:54 +0200
Articles 5 — 4 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  howto remove numbers after DOT Syed Jahanzaib <aacable79@gmail.com> - 2015-06-16 05:03 -0700
    Re: howto remove numbers after DOT Jörg Buchholz <bookwood4new@freenet.de> - 2015-06-18 07:22 +0200
      Re: howto remove numbers after DOT Syed Jahanzaib <aacable79@gmail.com> - 2015-06-18 02:12 -0700
        iec80000 notation (was: Re: howto remove numbers after DOT) Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-06-18 20:08 +0200
          Re: iec80000 notation Karl Ratzsch <mail.kfr@gmx.net> - 2015-06-22 22:54 +0200

#2936 — howto remove numbers after DOT

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-16 05:03 -0700
Subjecthowto remove numbers after DOT
Message-ID<c6107ef8-49d1-4a31-b753-f90988e4365c@googlegroups.com>
In gluplot i have graph which shows downloads per day for the month.
in labels it shows values like
2500.35
1500.15
6000.45

how can i show remove values after . (dot) so that it should show only this

2500
1500
6000

[toc] | [next] | [standalone]


#2939

FromJörg Buchholz <bookwood4new@freenet.de>
Date2015-06-18 07:22 +0200
Message-ID<mltkiq$a8c$1@newsserver.rrzn.uni-hannover.de>
In reply to#2936
On 16.06.2015 14:03, Syed Jahanzaib wrote:
> In gluplot i have graph which shows downloads per day for the month.
> in labels it shows values like
> 2500.35
> 1500.15
> 6000.45
>
> how can i show remove values after . (dot) so that it should show only this
>
> 2500
> 1500
> 6000
>
use "%.0f" as the format specifier in the sprintf command for plotting 
labels.

something like this:
plot "data.txt" using 1:($2/1024/1024):(sprintf("%.0f",$2/1024/1024)) 
with labels

Jörg

[toc] | [prev] | [next] | [standalone]


#2941

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-18 02:12 -0700
Message-ID<ddd22ccd-43fb-406a-a3cf-35f09ed3486e@googlegroups.com>
In reply to#2939
On Thursday, June 18, 2015 at 10:22:36 AM UTC+5, Jörg Buchholz wrote:
> On 16.06.2015 14:03, Syed Jahanzaib wrote:
> > In gluplot i have graph which shows downloads per day for the month.
> > in labels it shows values like
> > 2500.35
> > 1500.15
> > 6000.45
> >
> > how can i show remove values after . (dot) so that it should show only this
> >
> > 2500
> > 1500
> > 6000
> use "%.0f" as the format specifier in the sprintf command for plotting 
> labels.
> something like this:
> plot "data.txt" using 1:($2/1024/1024):(sprintf("%.0f",$2/1024/1024)) 
> with labels
> Jörg

Thanks it worked perfectly.
One thing more please. 
currently i am graphing downlods for the user account, but issue is the divide forumila. Is there any mehthod in which gnuplot cna auto measure the data like if its in KB , it should KB, if its in MB, it should show MB, if its in GB it should GB or vise versa. 

at a  moment I am dividing the formula like //2014/2014 to get data in GB, but what if data is more and I want to auto show it in TB by auto calulating the values? sorry for bad english.

[toc] | [prev] | [next] | [standalone]


#2943 — iec80000 notation (was: Re: howto remove numbers after DOT)

FromKarl-Friedrich Ratzsch <mail.kfr@gmx.net>
Date2015-06-18 20:08 +0200
Subjectiec80000 notation (was: Re: howto remove numbers after DOT)
Message-ID<mlv1f2$3el$1@solani.org>
In reply to#2941
Am 18.06.2015 um 11:12 schrieb Syed Jahanzaib:

> One thing more please. currently i am graphing downlods for the
> user account, but issue is the divide forumila. Is there any
> mehthod in which gnuplot cna auto measure the data like if its in
> KB , it should KB, if its in MB, it should show MB, if its in GB
> it should GB or vise versa.
> 
> at a  moment I am dividing the formula like //2014/2014 to get
> data in GB, but what if data is more and I want to auto show it
> in TB by auto calulating the values? sorry for bad english.
> 

For axis labels, there is a provision for automatic ki, Mi, Ti
notation, check "help format specifiers".

Otherwise you can build your own function returning the proper prefixes:

fstring(x) = sprintf("%.f ",\
		 x<2**10 ? (ps="",x) :\
		 x<2**20 ? (ps="Ki", x/2**10) : \
		 x<2**30 ? (ps="Mi", x/2**20) :\
		           (ps="Ti", x/2**30)).ps."Byte"

[toc] | [prev] | [next] | [standalone]


#2952 — Re: iec80000 notation

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2015-06-22 22:54 +0200
SubjectRe: iec80000 notation
Message-ID<mm9smc$v9j$1@solani.org>
In reply to#2943
Am 18.06.2015 um 20:08 schrieb Karl-Friedrich Ratzsch:
> 
> For axis labels, there is a provision for automatic ki, Mi, Ti
> notation, check "help format specifiers".
> 
> Otherwise you can build your own function returning the proper prefixes:
> 
> fstring(x) = sprintf("%.f ",\
> 		 x<2**10 ? (ps="",x) :\
> 		 x<2**20 ? (ps="Ki", x/2**10) : \
> 		 x<2**30 ? (ps="Mi", x/2**20) :\
> 		           (ps="Ti", x/2**30)).ps."Byte"
> 

or use gnuplots gprintf() function that knows the "%b %B" format

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web