Way to limit xtics in histogram

Gnuplot does not automaticly limit the amount of xticlabels in
histograms like it does with other plotting types.
To illustrate the problem:
http://shiona.ath.cx/count.png
I guess there are 61 xtics, maybe one of five could be ok.
Any help appreciated.

(Because some of you might possibly request the script, here it is:

set boxwidth 0.75 absolute
set style fill solid 1.00 border -1
set style data histogram
set style histogram cluster gap 1
set xtics nomirror out rotate by -30;

set title "Daily number of packages received from node \n \
during 18.11.2009 - 18.1.2009"

plot "ready/count" using 2:xtic(1) t '1978', \
     "ready/count" using 3 t '2473'

)
0
Juho
1/20/2010 11:59:52 AM
comp.graphics.apps.gnuplot 4955 articles. 0 followers. Post Follow

8 Replies
2080 Views

Similar Articles

[PageSpeed] 41

Juho Jokelainen wrote:

> Gnuplot does not automaticly limit the amount of xticlabels in
> histograms like it does with other plotting types.
> To illustrate the problem:
> http://shiona.ath.cx/count.png
> I guess there are 61 xtics, maybe one of five could be ok.
> Any help appreciated.

The form xtic(1) is shorthand for xtic(stringcolumn(1)).
That is, xtic(foo) really expects a function foo that returns a string. 

The command xtic(1) is doing exactly what you asked, which is to
place an tic label for every entry in column 1. So you need to do
something slightly different.  The basic idea should be evident
from this command:

  everyfifth(col) = (int(column(col) % 5 == 0) ? "A" : ""
  plot 'data' using 1:2:(everyfifth(0))

The function everyfifth(0) returns a string value for each point
in the data set.  Column 0 by convention holds the index of that
point within the data set. The string is set to "A" for every
5th point, and "" otherwise.

But you don't want "A". You want the contents of column 1,
treated as a string.  So we change this to

  everyfifth(col) = (int(column(col)) % 5 == 0) ? stringcolumn(1) : "") 


        Ethan

> 
> (Because some of you might possibly request the script, here it is:
> 
> set boxwidth 0.75 absolute
> set style fill solid 1.00 border -1
> set style data histogram
> set style histogram cluster gap 1
> set xtics nomirror out rotate by -30;
> 
> set title "Daily number of packages received from node \n \
> during 18.11.2009 - 18.1.2009"
> 
> plot "ready/count" using 2:xtic(1) t '1978', \
>      "ready/count" using 3 t '2473'
> 
> )

0
sfeam
1/20/2010 8:23:27 PM
> The command xtic(1) is doing exactly what you asked, which is to
> place an tic label for every entry in column 1. So you need to do
> something slightly different. =A0The basic idea should be evident
> from this command:
>
> =A0 everyfifth(col) =3D (int(column(col) % 5 =3D=3D 0) ? "A" : ""
> =A0 plot 'data' using 1:2:(everyfifth(0))
>
Thanks.
I was thinking that I'd propably need some kind of if-block there but
didn't know the syntax.
I also thought that there is "set xtics start, frequency" but that
doesn't seem to work for strings.
But yeah, this should get my work done, thanks again.
0
Juho
1/21/2010 1:42:04 AM
On Jan 21, 9:42=A0am, Juho Jokelainen <juho.jokelai...@gmail.com> wrote:
> > The command xtic(1) is doing exactly what you asked, which is to
> > place an tic label for every entry in column 1. So you need to do
> > something slightly different. =A0The basic idea should be evident
> > from this command:
>
> > =A0 everyfifth(col) =3D (int(column(col) % 5 =3D=3D 0) ? "A" : ""
> > =A0 plot 'data' using 1:2:(everyfifth(0))
>
> Thanks.
> I was thinking that I'd propably need some kind of if-block there but
> didn't know the syntax.
> I also thought that there is "set xtics start, frequency" but that
> doesn't seem to work for strings.
> But yeah, this should get my work done, thanks again.


Hi,
I have incorprated this solution into my gnuplot script.  But it
failed to generate histogram graph.
Could someone help me? Thanks.

My Data file (hist.txt):

bin distibution
0.100000 0.000000
0.200000 0.003273
0.300000 0.000818
0.400000 0.000818
0.500000 0.001637
0.600000 0.004092
0.700000 0.000818
0.800000 0.001637
0.900000 0.000818
1.000000 0.001637
1.100000 0.000000
1.200000 0.000000
1.300000 0.001637
1.400000 0.000818
1.500000 0.000818
1.600000 0.000818
1.700000 0.001637
1.800000 0.000000
1.900000 0.000000
2.000000 0.004910
2.100000 0.007365

My Gnuplot Script (bin_hist_gp.txt):
set xlabel "Bin Size "
set ylabel "Density "
unset key
set size 1.0, 1.0
set origin 0.0, 0.0
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.75
set t png size 400,300
everytenth(col) =3D (int(column(col))%10 =3D=3D0)?stringcolumn(1):""
plot "hist.txt" u 2:(everytenth(0)) title "Distribution"
set output
exit

And the final output message after it is executed in gnuplot.
"
gnuplot bin_hist_gp.txt

plot "hist.txt" u 2:(everytenth(0)) title "Distribution"
                                                         ^
"bin_hist_gp.txt", line 12: Too many columns in using specification

"

And when I replace the code 'plot "hist.txt" u 2:(everytenth(0)) title
"Distribution" ' as ' plot "hist.txt" u 2:xticlabels(everytenth(0))
title "Distribution"  '.  It failed with unrecognized message.   I
have no idea about the real issue.
0
GB2312
3/8/2010 7:05:59 AM
Am Montag, 8. M=C3=A4rz 2010 08:05:59 UTC+1 schrieb =E5=99=9C=E5=99=9C=E8=
=80=81=E5=85=AC:
> On Jan 21, 9:42=C2=A0am, Juho Jokelainen <juho.jokelai...@gmail.com> wrot=
e:
> > > The command xtic(1) is doing exactly what you asked, which is to
> > > place an tic label for every entry in column 1. So you need to do
> > > something slightly different. =C2=A0The basic idea should be evident
> > > from this command:
> >
> > > =C2=A0 everyfifth(col) =3D (int(column(col) % 5 =3D=3D 0) ? "A" : ""
> > > =C2=A0 plot 'data' using 1:2:(everyfifth(0))
> >
> > Thanks.
> > I was thinking that I'd propably need some kind of if-block there but
> > didn't know the syntax.
> > I also thought that there is "set xtics start, frequency" but that
> > doesn't seem to work for strings.
> > But yeah, this should get my work done, thanks again.
>=20
>=20
> Hi,
> I have incorprated this solution into my gnuplot script.  But it
> failed to generate histogram graph.
> Could someone help me? Thanks.
>=20
> My Data file (hist.txt):
>=20
> bin distibution
> 0.100000 0.000000
> 0.200000 0.003273
> 0.300000 0.000818
> 0.400000 0.000818
> 0.500000 0.001637
> 0.600000 0.004092
> 0.700000 0.000818
> 0.800000 0.001637
> 0.900000 0.000818
> 1.000000 0.001637
> 1.100000 0.000000
> 1.200000 0.000000
> 1.300000 0.001637
> 1.400000 0.000818
> 1.500000 0.000818
> 1.600000 0.000818
> 1.700000 0.001637
> 1.800000 0.000000
> 1.900000 0.000000
> 2.000000 0.004910
> 2.100000 0.007365
>=20
> My Gnuplot Script (bin_hist_gp.txt):
> set xlabel "Bin Size "
> set ylabel "Density "
> unset key
> set size 1.0, 1.0
> set origin 0.0, 0.0
> set style data histogram
> set style histogram cluster gap 1
> set style fill solid border -1
> set boxwidth 0.75
> set t png size 400,300
> everytenth(col) =3D (int(column(col))%10 =3D=3D0)?stringcolumn(1):""
> plot "hist.txt" u 2:(everytenth(0)) title "Distribution"
> set output
> exit
>=20
> And the final output message after it is executed in gnuplot.
> "
> gnuplot bin_hist_gp.txt
>=20
> plot "hist.txt" u 2:(everytenth(0)) title "Distribution"
>                                                          ^
> "bin_hist_gp.txt", line 12: Too many columns in using specification
>=20
> "
>=20
> And when I replace the code 'plot "hist.txt" u 2:(everytenth(0)) title
> "Distribution" ' as ' plot "hist.txt" u 2:xticlabels(everytenth(0))
> title "Distribution"  '.  It failed with unrecognized message.   I
> have no idea about the real issue.

Because this thread is nearly the only one I found while searching the web =
I will post my improved solution of every... here:

everyNth(countColumn,labelColumnNum,N) =3D((int(column(countColumn)) % N =
=3D=3D 0) ? stringcolumn(labelColumnNum) : "");

and you have to use it this way:

plot ... u 1:xtic(everyNth($2,2,10))
0
diru91
9/26/2012 8:28:01 AM
Is it possible that there is a syntax error in the code you have provided?
0
tommy
1/24/2014 12:35:52 AM
Am 24.01.2014 01:35, schrieb tommy.carstensen@gmail.com:
> Is it possible that there is a syntax error in the code you have provided?
> 

This is a newsgroup, dude, you have to quote the old posting.

I should sue google for stealing my old newspost and pretending i took
part in some "googlegroup". :-[
0
Karl
1/24/2014 1:48:47 PM
On Wednesday, September 26, 2012 4:28:01 AM UTC-4, dir...@googlemail.com wrote:
> Because this thread is nearly the only one I found while searching the web I will post my improved solution of every... here:

Here's a complete, stand-alone, runnable script:

#!/bin/sh

# Generate the input data file.  Columns are:
# 1 datapoint identifier
# 2 Y value
# 3 xtic labels
perl -e 'for(500..600) {
  printf "%d\t%.1f\t\"Foo %d\"\n",$_,rand($_)/10,$_
}
' >in.dat

gnuplot <<EOF
set term png size 1800, 1000
set xtics rotate by -90

nth(countCol,labelCol,n) = \
  ((int(column(countCol)) % n == 0) ? stringcolumn(labelCol) : "")

set output "out.png"
plot \
"in.dat" using 1:2:xtic(nth(1,3,10)) with linespoints \
   pointtype 2 linecolor rgb "red"
EOF

display out.png &
0
waxrat
6/16/2014 3:45:54 PM
Am 16.06.2014 17:45, schrieb waxrat@gmail.com:
> On Wednesday, September 26, 2012 4:28:01 AM UTC-4, dir...@googlemail.com wrote:
>> Because this thread is nearly the only one I found while searching the web I will post my improved solution of every... here:
> 
> Here's a complete, stand-alone, runnable script:
> 

It�d still be great if you gave everybody else here some context for
this. ;-)

People who use their newsreader instead of googlegroups don�t have the
previous posts directly at hand if they�re older than a few months or so.

 K



0
Karl
6/16/2014 4:28:43 PM
Reply:

Similar Artilces:

mac app store apps dl limits
Was thinking about picking up an app or two or three (pages, numbers and find any file). Apple person at the store said the Apple apps aren't just one system per buy but thought there was some sort of limit. Is this a app store variable, an app variable or what? And would anyone know what the deal is on the above mentioned apps is? Would re-installing software require a deauth before hand? In article <l5c6qq$tfa$1@dont-email.me>, M. John Matlaw <nouser@invalid.com> wrote: > Was thinking about picking up an app or two or three (pages, numbers and > fi...

Hovsepian: Apps! Apps! Apps!
Novell CEO: Apps Are Job No. 1 for Linux http://www.cio-today.com/story.xhtml?story_id=021001VE8HV3 <<< In order for Linux to grow into the computing mainstream, the open- source OS needs more applications and a standardized approach to software certification, Novell CEO Ron Hovsepian said in his keynote Wednesday at the LinuxWorld conference and trade show in San Francisco. "The No. 1 thing that we need on Linux is applications," he said. "Whether we like it or not, the application is what drives the final customer decision," he added. >>> John Bail...

histogram of histograms
Hi I have several text files that look like this: Brazil, 10 Brazil, 13 Brazil, 9 Bulgaria, 1 Canada, 48 Canada, 52 Canada, 38 Canada, 55 Canada, 59 Chile, 1 Chile, 1 Chile, 2 China, 7 China, 18 China, 19 China, 22 China, 25 I need to iterate through the above file(s) and get the data summarized in the form: Canada, 252 China, 91 Chile, 4 Brazil, 32 Bulgaria, 1 I know how to go from a single column list with multiple repeated values to a 'histogram' type list, ie: my_hash = countries.inject(Hash.new { 0 }) { |counts, key| counts[key] += 1; counts} my_hash = my_hash.sort { |a,b| a...

is there a way ..... any way
Hello folks, I tried lurking on but it stays jibberish to me. Questions asked are responded with a jargon that is beyond my comprehension and often in a tone you'll think twice to ask the next question. So this is too heavy for me (yet?). Is there a way that simple mortals can ask questions how to do things with perl/ work with perl. Is there a newsgroup? ok ok RTFM you'll say. Obviously you don't understand my question and despair. Andries Meijer Andries wrote: > I tried lurking on but it stays jibberish to me. Questions asked > are responded with a jargon that is beyon...

histograms with gnuplot ?
Hello! I am looking whether it is possible to do histogram diagrams with gnuplot ? I mean not to plot in this style (which I assume is possible anyway), but to evaluate the histogram from a set of data (e.g. just on column). If this is not possible please let me know so that I can search for alternatives. Thanks, Matthias Matthias Pospiech <matthias.pospiech@gmx.de> wrote: > Hello! > I am looking whether it is possible to do histogram diagrams with gnuplot ? > I mean not to plot in this style (which I assume is possible anyway), but to > evaluate the histo...

Looking for a way to access ActiveRecord data in a rails app from another non-rails app with $SAFE=1
I only need to read the data, but I want to use AR if I can, because it's what everything in the rails app uses, and I want to keep the whole area as simple and maintainable as possible. I don't see anything in Rails that allows special access. Perhaps if I make a certain kind of account will it let me in? It appears with $SAFE=1 I get locked out no matter what. xc Xeno Campanoli wrote: > I only need to read the data, but I want to use AR if I can, because > it's what everything in the rails app uses, and I want to keep the whole > area as simple and mainta...

how do I limit math output to say 2 digits like 2.33? I found way called precision setting but is that the right way?
curious On 7/5/12 3:41 PM, quiet_lad wrote: > curious Man format -- +------------------------------------------------------------------------+ | Gerald W. Lester, President, KNG Consulting LLC | | Email: Gerald.Lester@kng-consulting.net | +------------------------------------------------------------------------+ On 2012-07-05 22:41, quiet_lad wrote: > curious As Gerald points out, the proper way is the format command. I assume you are referring in the title to tcl_precision, but note that that is a leftov...

Graphical APPS replacement
Someone emailed me to tell me my icon choose utility wasn't working. Shucks. Anyway, I finally got around to making an APPS replacement using the internal rom calls to get any user added items in the APPS menu. So there is now a new command in the library called IAPPS that will display an icon form of the APPS menu, as well as any user added programs in the STAT menu, NSOLVE menu, or FINANCE menu. I'd like to make some nice little icons to put in there to make it into a true replacement, and possibly change/expand the order and content of the standard APPS menu, but I am fresh out o...

a question about gnuplot histogram
hello, i just started using gnuplot i'm looking for histogram function which is similar to matlab's hist: it shall read a list of numbers and then plot their 'distribution' ie it'll collect the numbers into 'bins' and draw a bar for each bin, where's the bar height is proportional to the amount of numbers inside that bin (in case i didn't explain myself well, this is what it should look like: http://www.caspur.it/risorse/softappl/doc/matlab_help/techdoc/ref/graphiac.gif) is such thing possible with gnuplot? i tried looking in the histogram demo but...

horizontal histograms in gnuplot
Does gnuplot have any functionality to draw horizontal bar plots (histograms)? Either in the latest-stable or in the devel. version? I went through the docs. and examples but did not find any. -- Rahul In article <Xns9AB1CFA38CEFD6650A1FC0D7811DDBC81@85.214.90.236>, Rahul <nospam@nospam.invalid> wrote: >Does gnuplot have any functionality to draw horizontal bar plots >(histograms)? No Either in the latest-stable or in the devel. version? I went >through the docs. and examples but did not find any. > >-- >Rahul -- Ethan A Merri...

Trellis graphics in gnuplot?
Anybody working on importing/ scripting trellis graphics for gnuplot? Here are some examples (I think some fancy multiplots might do the trick, but maybe not quite, plus I am hoping to stand on the shoulders of giants): http://plan9.bell-labs.com/cm/ms/departments/sia/project/trellis/display.examples.html TIA ...

Graphics Mapping App?
Are there any OS/2 apps running -- besides XAct -- which would be able to plot a data set on a map background given geographical coordinates? Anything from Unix/Linux which has been cross-compiled? It is not necessary the data is displayed on the monitor but rather that a standard graphics output file is created which can then be used by another application. TIA. Do you count Java apps? <www.cohort.com> CoPlot runs on OS/2 (I tried it) and seems to have facilities for plotting on maps (Orthographic, Mercator, and Conic) Actually, 1-2-3 also handles maps, it may do what you wan...

Patches for gnuplot
Where I could find patches from gnuplot4.0?? I find some patches on www.bmsc.washington.edu but when I tried install patches it displays some errrors. I use red hat linux 7.2 Please help me!! Z(eljko <zeljko@clab.hr> wrote: > Where I could find patches from gnuplot4.0?? At our SourceForge.net web pages. That's where you can also get the current work-in-progress version from anon CVS, if you feel brave. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain. Hans-Bernhard Broeker wrote: > Z(eljk...

Latex/Gnuplot limitations?
Dear readers I was wondering if there are limitations of what I can do in Gnuplot if it is made for Latex use? Here is an example where it goes wrong (for me atleast): set label 12 "rotate by -90 left" at 2, 2 left rotate by 45 back nopoint offset character 0, 0 set xrange [0:10] set yrange [0:10] set terminal latex set output "myplot.tex" replot plot -1 notitle This produces a figure where the text isn't rotated in Latex. Is "set terminal latex" very limited? And if so, what should use if I would like to produce PS and PDF files with L...

Web resources about - Way to limit xtics in histogram - comp.graphics.apps.gnuplot

Image histogram - Wikipedia, the free encyclopedia
... light and pure white areas. The vertical axis represents the size of the area that is captured in each one of these zones. Thus, the histogram ...

3D Photo Ring Lite - Picture Viewer to organize and sort photos by similar color histograms (research ...
Get 3D Photo Ring Lite - Picture Viewer to organize and sort photos by similar color histograms (research at Klagenfurt University, Austria) ...

CEO Compensation Histogram Chart - Business Insider
A histogram chart based on data from a Wall Street Journal study showing the distribution of CEO compensation

A Robust Histogram for Massive Parallelism
Preserving highly parallel performance when every thread is simultaneously trying to increment a single object

What the Histogram on Your Camera Actually Tells You
You've almost certainly seen a histogram on your camera's display at some point, but if you don't take photography particularly seriously you ...

An Explanation of What a Camera Histogram Graph is and How It Can Help You Take Better Photos
... course for CreativeLive , photographer John Greengo gives a simple explanation of that color graph on your camera’s display known as a histogram ...

How to Use the Image Histogram in iPhoto
... and plotting data. Perhaps you never quite understood why you needed to learn this. Until now! Sandro Cuccia shows you how a photo's Histogram ...

Post-Debate Bounce Histogram
Post-Debate Bounce Histogram

Restaurant histograms of the day
I have a column at Grub Street today looking at some check-by-check level data for five New York restaurants.

Dragons on the far side of the histogram
... other 499 guests have that problem… just deal with it”. You wouldn’t come back next Summer. So do have a look at the far side of your histogram. ...

Resources last updated: 2/8/2016 11:12:19 PM