Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

plotting non-numeric and non-time data on x axis

817 views
Skip to first unread message

Negandhi, Hiten

unread,
Jun 17, 2003, 3:36:29 PM6/17/03
to
Hi all,
Is there any way in GNUPlot of plotting a non-numeric or non-time data on
the X/Y axis?
For my database, I want to plot "file name" on x axis, and number of
read/write requests for that file on the Y axis. Is there any way to use
GNUPlot to do this?
Any help will be highly appreciated, thanks!


> Hiten Negandhi
> Database Administrator
> tyco/ Electronics
> Tel: (717) 810-2813
> Fax: (717) 810-2660
> MS: 194-009
> Email: hneg...@tycoelectronics.com
>
>
- -
[[[[ to unsubscribe from info-gnuplot, send an email with body
unsubscribe info-gnuplot
to majo...@dartmouth.edu
]]]]

Ding Li

unread,
Jun 17, 2003, 4:43:52 PM6/17/03
to
Please have a look at:
http://t16web.lanl.gov/Kawano/gnuplot/gallery/integ2.html

Is this what you want?

Ding

Negandhi, Hiten

unread,
Jun 17, 2003, 4:54:03 PM6/17/03
to
My datafile looks like this:

File1 20
File2 10
File3 50
File4 50
File5 90

So, I want to build my xtics dynamically using the first parameter from the
datafile. I wish I could say something like this

set xtics $1


Hiten

Ding Li

unread,
Jun 17, 2003, 5:31:27 PM6/17/03
to
Suppose you data file name is 'data'

set xtics ("File1" 1,"File2" 2,"File3" 3,"File4" 4,"File5" 5)
set xr [1:5]
plot 'data' u ($0+1):2 notitle w l
pause -1

This will give you what you want. You can generate this script
automatically.

John Bollinger

unread,
Jun 17, 2003, 5:07:50 PM6/17/03
to
--- "Negandhi, Hiten" <hneg...@tycoelectronics.com>

wrote:
> Hi all,
> Is there any way in GNUPlot of plotting a
> non-numeric or non-time data on
> the X/Y axis?
> For my database, I want to plot "file name" on x
> axis, and number of
> read/write requests for that file on the Y axis. Is
> there any way to use
> GNUPlot to do this?

To supress the x-axis labels:
unset xtics

To plot a one column data file using an implied
x-axis:
plot "file.ext" 0:1 with points

Does that help?

--jab


=====
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Ding Li

unread,
Jun 17, 2003, 5:58:39 PM6/17/03
to
On Tue, 17 Jun 2003, John Bollinger wrote:

> --- "Negandhi, Hiten" <hneg...@tycoelectronics.com>
> wrote:
> > Hi all,
> > Is there any way in GNUPlot of plotting a
> > non-numeric or non-time data on
> > the X/Y axis?
> > For my database, I want to plot "file name" on x
> > axis, and number of
> > read/write requests for that file on the Y axis. Is
> > there any way to use
> > GNUPlot to do this?
>
> To supress the x-axis labels:
> unset xtics
>
> To plot a one column data file using an implied
> x-axis:
> plot "file.ext" 0:1 with points

This should be:
plot 'file.ext' u 0:2 w p

but your method has no xtics at all which is not what he needs.

Ding

Ed Morton

unread,
Jun 17, 2003, 8:27:17 PM6/17/03
to

"Ding Li" <din...@condense.seas.ucla.edu> wrote in message
news:Pine.LNX.4.44.03061...@condense.seas.ucla.edu...

> Suppose you data file name is 'data'
>
> set xtics ("File1" 1,"File2" 2,"File3" 3,"File4" 4,"File5" 5)
> set xr [1:5]
> plot 'data' u ($0+1):2 notitle w l
> pause -1
>
> This will give you what you want. You can generate this script
> automatically.

See my attached response to an earlier question (Subject "Gnuplot" posted on
6/14 by Markus Latzel) for how to use awk to generate the tic labels
automatically (in that case for the Y axis).

Ed.

Markus Latzel wrote:

> Hans-Bernhard Broeker wrote:
> >
> > Only by a lot of manual work, so far. There's a patch to the
>
> Ok, i'll write a bash-Script for that manual work.

This'll do it:

set ytics (`awk '{printf("%s%s%s%s %d",sep,ti,$1,ti,NR-1);sep=", "}' ti="'"
datafile.dat`)
plot 'datafile.dat' using 2:0:(0.0):2 with xerrorbars pt 0

but your order of Names will be inverted since Name1 is the first (zero-th)
row.
If you want them un-inverted this would reverse the order of names in the
awk
script:

set ytics (`awk '{name[NR]=$1}END{for (i = NR; i > 0; i--)
{printf("%s%s%s%s%d",sep,ti,name[i],ti,NR-i);sep=", "}}' ti="'" tst1.dat`)

and presumably you could do something similair (or better!) with the plot
line,
or just reverse input file e.g. using "tac" on UNIX.

Ed.


Negandhi, Hiten

unread,
Jun 18, 2003, 11:31:03 AM6/18/03
to
Thanks for your response.

But, instead of "File1" thru "File5", it can have any text like "ABC1" thru
"ABC5" also.
How can I dynamically generate the set tics command to read the data file?

Hiten


-----Original Message-----
From: Ding Li [mailto:din...@condense.seas.ucla.edu]
Sent: Tuesday, June 17, 2003 5:31 PM
To: Negandhi, Hiten
Cc: 'info-g...@dartmouth.edu'

Subject: RE: plotting non-numeric and non-time data on x axis


Suppose you data file name is 'data'

set xtics ("File1" 1,"File2" 2,"File3" 3,"File4" 4,"File5" 5)
set xr [1:5]
plot 'data' u ($0+1):2 notitle w l
pause -1

This will give you what you want. You can generate this script
automatically.

Ding

On Tue, 17 Jun 2003, Negandhi, Hiten wrote:

> My datafile looks like this:
>
> File1 20
> File2 10
> File3 50
> File4 50
> File5 90
>
> So, I want to build my xtics dynamically using the first parameter from
the
> datafile. I wish I could say something like this
>
> set xtics $1
>
>
> Hiten
>
>
> -----Original Message-----
> From: Ding Li [mailto:din...@condense.seas.ucla.edu]
> Sent: Tuesday, June 17, 2003 4:44 PM
> To: Negandhi, Hiten
> Cc: 'info-g...@dartmouth.edu'
> Subject: Re: plotting non-numeric and non-time data on x axis
>
>
> Please have a look at:
> http://t16web.lanl.gov/Kawano/gnuplot/gallery/integ2.html
>
> Is this what you want?
>
> Ding
>
>

> On Tue, 17 Jun 2003, Negandhi, Hiten wrote:
>
> > Hi all,
> > Is there any way in GNUPlot of plotting a non-numeric or non-time data
on
> > the X/Y axis?
> > For my database, I want to plot "file name" on x axis, and number of
> > read/write requests for that file on the Y axis. Is there any way to use
> > GNUPlot to do this?

> > Any help will be highly appreciated, thanks!
> >
> >
> > > Hiten Negandhi
> > > Database Administrator
> > > tyco/ Electronics
> > > Tel: (717) 810-2813
> > > Fax: (717) 810-2660
> > > MS: 194-009
> > > Email: hneg...@tycoelectronics.com
> > >
> > >

Hans-Bernhard Broeker

unread,
Jun 18, 2003, 1:17:59 PM6/18/03
to
Negandhi, Hiten <hneg...@tycoelectronics.com> wrote:

> But, instead of "File1" thru "File5", it can have any text like
> "ABC1" thru "ABC5" also. How can I dynamically generate the set
> tics command to read the data file?

See one of the other responses in this thread for a script example.

[And guys, please learn not to top-post and full-quote without
thinking about it...]
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Ethan Merritt

unread,
Jun 18, 2003, 1:15:28 PM6/18/03
to
In article <8B9A6D74C43ED711A2A...@ammex002.amp.com>,

Negandhi, Hiten <hneg...@tycoelectronics.com> wrote:
>Thanks for your response.
>
>But, instead of "File1" thru "File5", it can have any text like "ABC1" thru
>"ABC5" also.
>How can I dynamically generate the set tics command to read the data file?

CVS version of gnuplot + patch #595850 from gnuplot SourceForge site.
More information and latest version of patch available at
http://www.bmsc.washington.edu/people/merritt/gnuplot

With this patched version you can generate your plot using the command

plot 'data' using 2:xtic(1) with impulses

That means "take data values from column 2 and corresponding xtic
labels from column 1".
--
Ethan A Merritt

Ding Li

unread,
Jun 18, 2003, 2:10:24 PM6/18/03
to
Hi,Hiten

You can write a scipt that can dynamically change the tics according to
your data files. There should be no problems with this.

Ding

On Wed, 18 Jun 2003, Negandhi, Hiten wrote:

> Thanks for your response.
>
> But, instead of "File1" thru "File5", it can have any text like "ABC1" thru
> "ABC5" also.
> How can I dynamically generate the set tics command to read the data file?
>

0 new messages