Message Boards Message Boards

1
|
13291 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

Is there an option for ListPlot that uses x and y values from two lists?

Posted 10 years ago

list1 is X values list2 is Y values

The x and y values in each are in order with each other.

Can I get ListPlot to assemble these two lists as x,y points in a scatter plot?

I don't see the option.

POSTED BY: Douglas Youvan
2 Replies

Thank you George - I should have looked more carefully at commands for list manipulation rather than options under ListPlot. That saves me a few lines of code for constructing a dummy list for plotting.

Maybe Wolfram documentation should actually show Transpose under ListPlot. I did look!

Doug

POSTED BY: Douglas Youvan

Use Transpose.

list1 = {1, 2, 5, 6, 8, 15};
list2 = {.2, .5, .8, 1.4, 1.0, .1};
ListPlot[Transpose[{list1, list2}]]

This should do what you want.

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract