# Require assistance with plotting data!

I am new to mathematica and i was wondering if someone could help me to plot some data;

This is my data that I need to use:

time  = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 16};
tsh = {2.1, 1.2, .3, .25, .2, .2, .15, .1, .05, .05, .1, .1};
t3 = {.5, .6, .7, .85, .75, .9, 1, 1.25, 1.5, 1.75, 1.7, 1.6};
t4 = {.25, .35, .4, .5, .6, .65, .6, .7, .9, .75, 1.1, .95};


I know how to plot some basic data but I began to struggle when I have been asked to incorporate all three data sets into one plot. They differ by the units assigned;

For example, time in "time/weeks", tsh in "arbitrary units / ml", t3 in "ng/ml^-1" and t4 in "microgram / ml^-1".

What I need to do is to plot tsh, t3 and t4on same plot and I can't seem to find a way :S

I would also appreciate if someone could explain how to carry out the unit conversion using Mathematica if that's possible;

-
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jan 13 at 2:34
There are things to do after your question is answered. It's a good idea to stay vigilant for some time, better approaches may come later improving over previous replies. Experienced users may point alternatives, caveats or limitations. New users should test answers before voting and wait 24 hours before accepting the best one. Participation is essential for the site, please come back to do your part tomorrow – rhermans Jan 20 at 16:19

## 3 Answers

TemporalData is your friend:

time = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 16};
tsh = {2.1, 1.2, .3, .25, .2, .2, .15, .1, .05, .05, .1, .1};
t3 = {.5, .6, .7, .85, .75, .9, 1, 1.25, 1.5, 1.75, 1.7, 1.6};
t4 = {.25, .35, .4, .5, .6, .65, .6, .7, .9, .75, 1.1, .95};

td = TemporalData[{tsh, t3, t4},{time}]

ListLinePlot[td,
PlotLegends ->
{
"tsh arbitrary units/ml"
,"t3 ng/ml^-1"
,"t4 microgram/ml^-1"
}
,AxesLabel->{"time (weeks)", "concentration"}
]


-
beat me to it. :) – rcollyer Jan 13 at 2:45

Is this adequate?

time = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 16};
tsh = {2.1, 1.2, .3, .25, .2, .2, .15, .1, .05, .05, .1, .1};
t3 = {.5, .6, .7, .85, .75, .9, 1, 1.25, 1.5, 1.75, 1.7, 1.6};
t4 = {.25, .35, .4, .5, .6, .65, .6, .7, .9, .75, 1.1, .95};
ListPlot[{Transpose[{time, tsh}], Transpose[{time, t3}], Transpose[{time, t4}]},
PlotLegends -> {"tsh arbitrary units/ml", "t3 ng/ml^-1",
"t4 microgram/ml^-1"}, AxesLabel->{"time (weeks)", "concentration"}]


This code didn't do any unit conversion, partly because you had simple lists of coefficients without any units attached and partly because all your numbers were similar enough that any unit conversion could be pushed off into the plot legend for the reader to make sense of. If your t3 numbers, for example, had been 0.0001 to 0.0002 then it would have required some scaling of the numbers to get all the plots to show large enough variation to be understandable. Sometimes people will ask why they can't have three different axes, all scaled differently, etc. There is no upper bound on how much stuff people want to magically happen in graphics. It is often fairly quick and easy to get some sort of graphic and then need to spend ten or a hundred times as much work to try to get the graphics to appear (almost) exactly the way that someone wants.

If you need more information about handling some particular bit of Mathematica for this then just leave a question in the comments and someone might be able to give you a tip to get you started.

-

There are many ways to do this. I have voted for the TemporalData approach. I present this just to illustrate relabelling ticks. I have also corrected the units to match concentrations for TSH (thyroid stimulating hormone), T3 (triodothyronine ) and T4(thyroxine),e.g."ng/ml^-1" is "ng.ml" but should be either "ng/mL" or "ng.mL^(-1)" etc.

ListPlot[{tsh, t3, t4}, Frame -> True, Joined -> True,
FrameTicks -> MapIndexed[{#2[[1]], #1} &, time],
FrameLabel -> {"Weeks", "Concentration"},
PlotLegends -> {"TSH (U/L)",
"T3 (ng\[CenterDot]\!$$\*SuperscriptBox[\(mL$$, $$-1$$]\))",
"T4 (\[Mu]g\[CenterDot]\!$$\*SuperscriptBox[\(mL$$, $$-1$$]\))"}]


Nice illustration of presumably of effect of thyroid hormone replacement for hypothyroidism. Reference limits for various components could be added and color coded, e.g. using GridLines or by adding lines.

-