wolfram mathematica - Plot using one column from a table as the x-value, other columns as y-values -
i have matrix, first column being time, , second column being position of a, third column position of b, etc. plot positions of a, b, ..., functions of time, in same figure. there more efficient way in mathematica making plots column column , combining them "show"?
also, plots have colors automatically chosen differ each other; let automation useful, legend automatically generated @ same time. how in mathematica?
thanks!
[update]: chris' method works extremely well. default legend uses small dot colors bit difficult tell; also, there seems 4 colors; in case there ~20 y-values, making legend useless. there other symbols bigger, , more colors (e.g., grayscales or continuously varying colors)?
a = {{{2001, 1, 1}, 2, 3, 4}, {{2002, 1, 1}, 3, 4, 5}, {{2003, 1, 1}, 4, 5, 6}, {{2004, 1, 1}, 5, 6, 7}, {{2005, 1, 1}, 6, 7, 8}}; datelistplot[mapthread[transpose[{#1, #2}] &, {table[first /@ a, {length@rest@last@a}], transpose[rest /@ a]}], joined -> true, plotlegends -> {"a", "b", "c"}]
Comments
Post a Comment