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


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

How to remove labeles from lines

Started byatheofilu@gmail.com
First post2015-04-07 07:02 -0700
Last post2015-04-08 01:09 -0700
Articles 3 — 3 participants

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


Contents

  How to remove labeles from lines atheofilu@gmail.com - 2015-04-07 07:02 -0700
    Re: How to remove labeles from lines Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-04-07 20:57 +0200
      Re: How to remove labeles from lines Andreas Theofilu <atheofilu@gmail.com> - 2015-04-08 01:09 -0700

#2871 — How to remove labeles from lines

Fromatheofilu@gmail.com
Date2015-04-07 07:02 -0700
SubjectHow to remove labeles from lines
Message-ID<636fec43-7a39-448b-9dd9-86eb3d4a9759@googlegroups.com>
Hallo,

this is a small script I wrote. This script works:

set title "Power consumption."
set terminal pngcairo  transparent font "arial,10" fontscale 1.0 size 850, 600
set output '/tmp/histograms.png'
set datafile missing '-'
set key under
set key invert autotitle columnhead
set style data histogram
set style histogram clustered gap 1 title offset 2,0.25
set style fill solid noborder
set boxwidth 0.95
unset xtics
set xtics rotate by -45
set ylabel "kWh"
set ytics
set grid y
set auto y
unset key
set bmargin 10
set yrange [ 0.0 : 40.0 ] noreverse nowriteback
plot '/tmp/energy.dat' using 1:xticlabel(3) with histogram, '' using 0:($1 > 0 ? $1 : NaN):1 with labels rotate by 70 offset -1,1,
 '' using 2:xticlabel(3) with histogram, '' using 0:($2 > 0 ? $2 : NaN):2 with labels rotate by 70 offset 1,1

This are a data sample:

27    0     "main counter"
11    0     "lift"
3     0     "pool"
0     2     "PHV1"
0     3     "PHV2"

This produces a histogram where the first 3 lines are red and the last 2 lines are green. On top of the lines it plots the value.

I tried to change the script so, that it doesn't plot the value on top of each line. The rest should stay as it is. Changing the last 2 lines into:

plot '/tmp/energy.dat' using 1:xticlabel(3) with histogram, '' using 0:($1 > 0 ? $1 : NaN):1 offset -1,1,
 '' using 2:xticlabel(3) with histogram, '' using 0:($2 > 0 ? $2 : NaN):2 offset 1,1

This doesn't plot the values on top of the lines, but the green values are ploted as thin green lines with an X somewhere. Why is this? What have I done wrong and how can I change the script to only avoid the values on top of the lines?

A.T.

[toc] | [next] | [standalone]


#2872

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2015-04-07 20:57 +0200
Message-ID<coinl9FqfdvU1@mid.dfncis.de>
In reply to#2871
Am 07.04.2015 um 16:02 schrieb atheofilu@gmail.com:

> This doesn't plot the values on top of the lines, but the green
> values are ploted as thin green lines with an X somewhere. Why is
> this?

Because your plot command requested it.  What exactly did you expect the 
2nd and 4th entry in that plot command to do?  Why did you leave those 
in there, instead of just removing them entirely?  This is what
your command looks like, in a slightly adjusted format:

plot '/tmp/energy.dat' using 1:xticlabel(3) with histogram, \
   '' using 0:($1 > 0 ? $1 : NaN):1 offset -1,1, \
   '' using 2:xticlabel(3) with histogram, \
   '' using 0:($2 > 0 ? $2 : NaN):2 offset 1,1

Whereas you appear to want this:

plot '/tmp/energy.dat' using 1:xticlabel(3) with histogram, \
   '' using 2:xticlabel(3) with histogram, \

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


#2873

FromAndreas Theofilu <atheofilu@gmail.com>
Date2015-04-08 01:09 -0700
Message-ID<8747cd4d-60a7-4447-bc95-29fffc91fc4b@googlegroups.com>
In reply to#2872
Am Dienstag, 7. April 2015 20:57:47 UTC+2 schrieb Hans-Bernhard Bröker:
> Am 07.04.2015 um 16:02 schrieb atheofilu@gmail.com:
> 
> Because your plot command requested it.  What exactly did you expect the 
> 2nd and 4th entry in that plot command to do?  Why did you leave those 
> in there, instead of just removing them entirely?  This is what
> your command looks like, in a slightly adjusted format:
> 
[...]
>
> Whereas you appear to want this:
> 
> plot '/tmp/energy.dat' using 1:xticlabel(3) with histogram, \
>    '' using 2:xticlabel(3) with histogram, \

Thanks a lot. This did it!
I was thinking a way too complicated.

A.T.

[toc] | [prev] | [standalone]


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


csiph-web