Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Brendan Halpin Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Plotting frequency of word occurences Date: Tue, 13 Nov 2012 21:11:51 +0000 Lines: 42 Message-ID: <878va58ay0.fsf@wivenhoe.ul.ie> References: <41723be4-5840-4ecb-9a4c-91a710117d9f@googlegroups.com> Reply-To: brendan.halpin@ul.ie Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net 70DPCy3wpacv3HxWFSpTewlWYeh4RdL0XxnOpdj8Y7L2r+f3n2kWZQzmnPZj99lpT0 Cancel-Lock: sha1:Xgl2Dxv/1TU3gr5sLd6NFnc1HDA= sha1:J5Nn/xLiZSpr//9XNecnN6fKu2A= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) Xref: csiph.com comp.graphics.apps.gnuplot:1487 On Tue, Nov 13 2012, hogiaus@gmail.com wrote: > This seems like it should be dead simple, but extensive googleing has > yielded no results. Say I have a datafile like so: > > ----- > neutron > neutron > e- > proton > [Li]8 > neutron > [Si]28 > [Li]8 > e- > ----- > > And I want to make a histogram that will determine all unique strings, > and display the counts of each one, e.g. 3 neutron, 2 e-, 1 proton, 2 > [Li]8, 1 [Si]28. If you're in a unixy environment, first process your data using shell commands: sort particles.dat | uniq -c > pcount.dat Then (derived from http://www.dcs.bbk.ac.uk/~gzoum01/howtos/gnuplot_barcharts.html), in gnuplot: gnuplot> set boxwidth 1 relative gnuplot> set style data histograms gnuplot> set style fill solid 1.0 border -1 gnuplot> plot [][0:] "pcount.dat" using 1:xticlabels(2) Brendan -- Brendan Halpin, Department of Sociology, University of Limerick, Ireland Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F1-009 x 3147 mailto:brendan.halpin@ul.ie ULSociology on Facebook: http://on.fb.me/fjIK9t http://teaching.sociology.ul.ie/bhalpin/wordpress twitter:@ULSociology