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


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

Labels with Divided Value

Started bySyed Jahanzaib <aacable79@gmail.com>
First post2015-06-04 08:36 -0700
Last post2015-06-16 03:40 -0700
Articles 8 — 2 participants

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


Contents

  Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-04 08:36 -0700
    Re: Labels with Divided Value Ethan A Merritt <EAMerritt@gmail.com> - 2015-06-04 21:12 -0700
      Re: Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-04 21:49 -0700
        Re: Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-04 21:52 -0700
          Re: Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-04 21:58 -0700
            Re: Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-04 22:21 -0700
              Re: Labels with Divided Value Ethan A Merritt <EAMerritt@gmail.com> - 2015-06-06 09:33 -0700
                Re: Labels with Divided Value Syed Jahanzaib <aacable79@gmail.com> - 2015-06-16 03:40 -0700

#2921 — Labels with Divided Value

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-04 08:36 -0700
SubjectLabels with Divided Value
Message-ID<5ed41c4d-aca0-4823-b72e-e8bb2b9aed17@googlegroups.com>
Greetings,

I have created a graph with the help of GNUPLOT. It's working good. Problem is that I want to show Download /Upload Data in GB in LABELS and its showing in bytes. How can I add formulat to dvidie teh bytes values in LABELS ?


My GNUPLOT CFG file is as follow

reset
set terminal jpeg
set output "/var/www/radius.jpg"
set xdata time
set timefmt "%Y-%m-%d"
set format x "%d/%m"
set xtics 86400
set xtics rotate by -45
set xlabel "Date (day/month)"
set ylabel "Data Downloaded in MB"
set title "username - $1 - Download/Upload Report $FULLMONTH $YEAR \nThis report was created on $NOW\nPowered by Syed Jahanzaib"
set key outside
set grid
set style data histogram
set style histogram cluster gap 1
set style fill solid
set boxwidth 0.9
plot "/tmp/userdata.txt" using 1:(\$2/1024/1024/1024) w boxes title "Download" lw 15, \
"/tmp/userdata.txt" using 1:(\$3/1024/1024/1024) w boxes lw 6 title "Upload", \
"/tmp/userdata.txt" using 1:(\$2/1024/1024/1024):2 w labels


and data file is as follows which have the values

cat /tmp/userdata.txt
[date]     [Download]   [Upload]
2015-05-01 4474024942   4254178590
2015-05-02 2414432830   106085629
2015-05-03 577354896    30842461
2015-05-04 440391880    25135023
2015-05-05 9393497144   1455046027
2015-05-06 840315630    72266841
2015-05-07 202235475299 6584315949
2015-05-09 8271128995   574005680
2015-05-10 39158708     55439832


with this config, I am getting LABEL values in bytes, and I want to show them in GB in LABELS.

[toc] | [next] | [standalone]


#2922

FromEthan A Merritt <EAMerritt@gmail.com>
Date2015-06-04 21:12 -0700
Message-ID<mkr7h9$pad$1@dont-email.me>
In reply to#2921
Syed Jahanzaib wrote:

> Greetings,
> 
> I have created a graph with the help of GNUPLOT. It's working good.
> Problem is that I want to show Download /Upload Data in GB in LABELS
> and its showing in bytes. How can I add formulat to dvidie teh bytes
> values in LABELS ?
> 
> 
> My GNUPLOT CFG file is as follow
> 
> reset
> set terminal jpeg
> set output "/var/www/radius.jpg"
> set xdata time
> set timefmt "%Y-%m-%d"
> set format x "%d/%m"
> set xtics 86400
> set xtics rotate by -45
> set xlabel "Date (day/month)"
> set ylabel "Data Downloaded in MB"
> set title "username - $1 - Download/Upload Report $FULLMONTH $YEAR
> \nThis report was created on $NOW\nPowered by Syed Jahanzaib" set key
> outside set grid
> set style data histogram
> set style histogram cluster gap 1
> set style fill solid
> set boxwidth 0.9
> plot "/tmp/userdata.txt" using 1:(\$2/1024/1024/1024) w boxes title
> "Download" lw 15, \ "/tmp/userdata.txt" using 1:(\$3/1024/1024/1024) w
> boxes lw 6 title "Upload", \ "/tmp/userdata.txt" using
> 1:(\$2/1024/1024/1024):2 w labels
> 
> 
> and data file is as follows which have the values
> 
> cat /tmp/userdata.txt
> [date]     [Download]   [Upload]
> 2015-05-01 4474024942   4254178590
> 2015-05-02 2414432830   106085629
> 2015-05-03 577354896    30842461
> 2015-05-04 440391880    25135023
> 2015-05-05 9393497144   1455046027
> 2015-05-06 840315630    72266841
> 2015-05-07 202235475299 6584315949
> 2015-05-09 8271128995   574005680
> 2015-05-10 39158708     55439832
> 
> 
> with this config, I am getting LABEL values in bytes, and I want to
> show them in GB in LABELS.

instead of using
    plot "" using 1:($2/1024/1024/1024):2 w labels

use

    plot "" using 1:($2 / 2**30):(sprintf("%.2f GB", $2 / 2**30)) w labels



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


#2923

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-04 21:49 -0700
Message-ID<2d16b297-001b-4443-b873-ce9ad49af691@googlegroups.com>
In reply to#2922
Its giving error

gnuplot> plot "/tmp/userdata.txt"  using 1:( / 2**30):(sprintf("%.2f GB",  / 2**30)) w labels
                                             ^
         line 0: invalid expression

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


#2924

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-04 21:52 -0700
Message-ID<5d54fbba-f568-476d-ad16-5153d689634a@googlegroups.com>
In reply to#2923
and if i use

plot "userdata.txt"  using 1:($2 / 2**30):(sprintf("%.2f GB", $2 / 2**30)) w labels

then it gives

gnuplot> plot "userdata.txt"  using 1:( / 2**30):(sprintf("%.2f GB",  / 2**30)) w labels
                                        ^
         line 0: invalid expression

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


#2925

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-04 21:58 -0700
Message-ID<9f5bc443-1887-44cc-a298-706b2b6abfc0@googlegroups.com>
In reply to#2924
Ahhh never mind Got i

I had to change $2 to \$2 :)

thanks for your support

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


#2926

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-04 22:21 -0700
Message-ID<2eee5f38-a185-4e82-8186-9853e419ddba@googlegroups.com>
In reply to#2925
All is good ,but the labels on bars (showing data downloaded in GB)is overriding by the BAR on top. How can I set label to NOT override by the bars.?

text override Example is showed here
http://click.onmypc.net:1235/radius.jpg

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


#2928

FromEthan A Merritt <EAMerritt@gmail.com>
Date2015-06-06 09:33 -0700
Message-ID<mkv7aa$r5u$1@dont-email.me>
In reply to#2926
Syed Jahanzaib wrote:

> All is good ,but the labels on bars (showing data downloaded in GB)is
> overriding by the BAR on top. How can I set label to NOT override by
> the bars.?
> 
> text override Example is showed here
> http://click.onmypc.net:1235/radius.jpg

# offset labels by 0 horizontal and 2 vertical characters:

gnuplot>  plot ...  with labels offset 0,2

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


#2935

FromSyed Jahanzaib <aacable79@gmail.com>
Date2015-06-16 03:40 -0700
Message-ID<41657367-2972-4469-91c3-408771d037a3@googlegroups.com>
In reply to#2928
On Saturday, June 6, 2015 at 9:33:26 PM UTC+5, Ethan A Merritt wrote:
> Syed Jahanzaib wrote:
> 
> > All is good ,but the labels on bars (showing data downloaded in GB)is
> > overriding by the BAR on top. How can I set label to NOT override by
> > the bars.?
> > 
> > text override Example is showed here
> > http://click.onmypc.net:1235/radius.jpg
> 
> # offset labels by 0 horizontal and 2 vertical characters:
> 
> gnuplot>  plot ...  with labels offset 0,2

Thx, [with some modification] It worked perfectly :) thank u 

[toc] | [prev] | [standalone]


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


csiph-web