So I recently started using Mathematica and I haven't been able to figure out how to simply plot elements of one matrix versus another matrix which are not directly related or are not a function of each other. The way I understand Plot in Mathematica is that it can only plot functions.

For Eg: Consider 2 matrices

a1 = Table[Subscript[a, i, j], {i, 1}, {j, 100}]
b1 = Table[Subscript[b, i, j], {i, 1}, {j, 100}]

Assume through the main code body, all the elements of both the matrices have been filled. Also its important to remember that both the matrices are not related. So how to go about plotting the elements of matrix a1 versus elements of matrix b1?

The same requirement is very simple in matlab:


closed as off-topic by ciao, user9660, Sumit, m_goldberg, J. M. will be back soon Jun 20 '16 at 12:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – ciao, Community, Sumit, m_goldberg, J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ From here: "If X and Y are both matrices, then they must have equal size. The plot function plots columns of Y versus columns of X." So, just use ListPlot[]/ListLinePlot[] along with a judicious use of Transpose[]. $\endgroup$ – J. M. will be back soon Jun 20 '16 at 6:31
a = Table[j^2, {j, 1, 25}];
b = Table[Log@j, {j, 1, 25}];

ListPlot[Transpose[{a, b}]]

enter image description here

  • $\begingroup$ The thing is that in my case a and b have already stored values from the results of other functions and are not functions of j itself. How do you write the code for that? $\endgroup$ – Sone Jun 20 '16 at 7:42
  • $\begingroup$ a and b in my example are arbitrary lists of numbers. You can use imported lists like a=Import["file path"] . However, let's read help info about data import to prevent further technical questions.. $\endgroup$ – Rom38 Jun 20 '16 at 8:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.