MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to plot ....................

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59400] Re: [mg59396] How to plot ....................
  • From: ggroup at sarj.ca
  • Date: Mon, 8 Aug 2005 06:17:03 -0400 (EDT)
  • References: <200508080734.DAA03479@smc.vnet.net>
  • Reply-to: ggroup at sarj.ca
  • Sender: owner-wri-mathgroup at wolfram.com

On Monday, August 8, 2005 at 03:34 GMT -0400, T. K. Ghosh wrote:

> I need a help to plot a data file.

> Suppose I have a data file with the extension filename.dat. This
> data file has more than 2 columns, say there are 3 columns. I would
> like to plot column 1 vs column 2 and similarly column 1 vs column 3
> on the same frame. I can easily plot this data file using GNU plot.
> Is it possible to use Mathematica to plot such a data file?


It's fairly easy.  You need to first import the data, but that will
depend on the format.  You can try something like:

rawdata = Import["filename.dat", "Table"];

You can then extract the first column using:

col1 = Transpose[rawdata][[1]];

Similarly, columns 2 and 3 are obtained using:

col2 = Transpose[rawdata][[2]];
col3 = Transpose[rawdata][[3]];

Depending on what all you want to do with the data, I find that it is
often convenient to form tables with just the x column and the y
column of data. So in this case, it would be:

xy12 = Transpose[{col1, col2}];
xy13 = Transpose[{col1, col3}];

To plot, you could use a couple of ListPlot commands, but it is
often much easier to use the MultipleListPlot package:

<<Graphics`MultipleListPlot`
MultipleListPlot[ xy12, xy13 ]

MultipleListPlot has many formatting options that you can use to get
the presentation you desire.  An easy way to get to the help section
is to use the command:
?MultipleListPlot

Hope that helps get you started.


  • Prev by Date: Re: running notebook from command line...
  • Next by Date: Re: Simplify Oddity
  • Previous by thread: How to plot ....................
  • Next by thread: Re: How to plot ....................