Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

How to specify x-axis in List when using ListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127870] How to specify x-axis in List when using ListPlot
  • From: Jack Heanult <john.h.hayden at gmail.com>
  • Date: Tue, 28 Aug 2012 04:53:22 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net


I have imported a csv file into a list with this stmt:

data1 = Take[Import["D:\_reports\optim_5_60_b_2.csv", "CSV"], 5]

Which gives:

{{1, 8, 9, 1}, {2, 2, 8, 1}, {3, 8, 9, 2}, {4, 3, 7.5, 2}, {5, 3, 7.5, 1}}

I would like to create a plot where the x-axis is based on the first field:

1,2,3,4,5

And the plot creates a line for each subsequent field, so the 2nd fields are:

8,2,8,3,3 and this would be plotted as a line.

This would be the first line on the y-axis, the other y-axis values would be plotted in the same manner. I would like the first y-plot to be plotted in red, and the second in blue, and the third in green with chart labels.

Just to get it to plot I have tried:
tobeplotted =  With[{LocalX = data1[[All, 1]]},
   Transpose[{LocalX, #}] & /@ Transpose[data1[[All, 2 ;;]]]]

ListPlot[tobeplotted, PlotStyle -> {Red, Blue, Green},  PlotMarkers -> {Automatic, 10}]

But the resulting plot is not what I want.

The first column in the csv file is the 'test number' (1) the 2nd(8), 3rd (9), are the test variables, and the 4th(1) column is the result. I would like to see how the test results vary as the variables change. Perhaps ListPlot is not what I want, it was my thought just to see something similar to what I can do in a Excel graph.

Any help is most appreciated.



  • Prev by Date: coloring individual hexagons in a grid...
  • Next by Date: Re: Landau letter, Re: Mathematica as a New Approach...
  • Previous by thread: Re: coloring individual hexagons in a grid...
  • Next by thread: Re: How to specify x-axis in List when using ListPlot