How to use ListLinePlot function with some data in a List in Mathematica 6?

Hi,

I am a beginner of Mathematica. Now I have a question on drawing a diagram with some data in a List.

I have a 2-D List like this:  
        animal = { {Dog, 1}, {Cat, 2}, {Rabbit, 3}, ... }

How can I draw a line (ListLinePlot) with numbers in the List above only? In other words, I wish to draw a line with data 1, 2, 3, ... the names of animal can be ignored.

Thanks in advance for any help.

oscar_1470Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AdnanKurtovicCommented:
ListPlot - draws lines
animal[i][2] - will access numbers in your array (actually i-th element)

Combine those to get what you need. I dont have Mathematica here so I can not write a code, but if you dont succeed alone with this help I'll do it later :D
0
AdnanKurtovicCommented:
I have not seen logical problem you have: point is defined with two variables x and y coordinate and you only have one ???
0
oscar_1470Author Commented:
to AdnanKurtovic,

First, thanks for your help.

I have only data for y variable. The x axis just uses the natural number.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

AdnanKurtovicCommented:
What do you mean "natural number"? Please explain. Could you give an example?
0
oscar_1470Author Commented:
Natural number means {1, 2, 3, 4, ...}

Given animal = { {Dog, 10}, {Cat, 20}, {Rabbit, 30}, ... }, the result diagram should be a line passing through {x, y} = {1, 10}, {2, 20}, {3, 30}, ...
0
AdnanKurtovicCommented:
Sorry for not answering when I promised :( Here is the code:

animal = { {Dog, 1}, {Cat, 2}, {Rabbit, 3} }
 
myArray = {}
 
For[i=1, i<=Length[animal],i++,
  AppendTo[myArray, {i, animal[[j,2]]}
]
 
ListPlot[myArray, PlotJoined->True]
 
(* or draw only points like this *)
ListPlot[myArray, PlotStyle->PointSize[0.05]
  

Open in new window

0
AdnanKurtovicCommented:
Sorry, there is one bracket missing in code. Here is corrected version:

animal = { {Dog, 1}, {Cat, 2}, {Rabbit, 3} }
 
myArray = {}
 
For[i=1, i<=Length[animal], i++,
  AppendTo[myArray, {i, animal[[j,2]]}];
]
 
ListPlot[myArray, PlotJoined->True]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oscar_1470Author Commented:
Thanks for your great help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.