Beautify a NDSolve Graph ! [duplicate]

I am doing the following:

xxt = {x1[t], x2[t], x3[t], x4[t]};
eqDiff = {x1'[t] == -x1[t], x2'[t] == x2[t], x3'[t] == -15 x3[t],
x4'[t] == x4[t]};
inCond = {x1[0] == 0.1, x2[0] == -0.1, x3[0] == 0.2, x4[0] == 0.1};
systEq = Join[eqDiff, inCond];
sol = NDSolve[systEq, xxt, {t, 0, 2}]
Plot[xxt /. sol, {t, 0, 2}]


How can I add different Colors to the different Solutions, together with a label ?

• Possible duplicate (without the label question) of mathematica.stackexchange.com/q/1731/187 Commented Dec 22, 2016 at 16:12
• ListLinePlot@sol[[1, All, 2, 0]] or ListLinePlot[sol[[1, All, 2, 0]], PlotLegends -> xxt] Commented Dec 22, 2016 at 16:34

Plot[Evaluate[xxt /. sol], {t, 0, 2}, PlotLegends -> {"s1", "s2", "s3", "s4"}]


• Wow. Perfect Thanks a lot !! Commented Dec 22, 2016 at 16:11

For more option for Plot you should visit here.

 Plot[Evaluate[xxt /. sol], {t, 0, 2},
PlotStyle -> {Red, Green, Blue, Black}, Frame -> True,
FrameLabel -> {t, Xs}, ImageSize -> 700,
PlotLegends ->
Placed[LineLegend[{"x1[t]", "x2[t]", "x3[t]", "x4[t]"},
LegendFunction -> Frame, LegendMarkerSize -> {{55, 10}}], {0.15,
0.15}]]


Edit

To improve the visibility of the frame then just add FrameStyle -> Directive[Black, Bold, 12] to the above Plot command. But if you are like me and always not satisfied with the plots generated by Mathematica, Maple and Matlab, I use Tecplot.

To be able to produce plots in Tecplot, first you need to generate data from the plot you already had in Mathematica. This can be done like this,

data = Plot[Evaluate[xxt /. sol], {t, 0, 2}];
points = Cases[Normal@data,
Line[pts_, ___] :> Flatten[pts, Depth[pts] - 3], Infinity];
ifuncts =
Interpolation[#, Method -> "Spline", InterpolationOrder -> 2][t] & /@
points;
data = Table[Prepend[ifuncts, t], {t, 0, 2, .1}];
TableForm[data,
TableHeadings -> {None, Prepend[Array["X", Length[points]], t]}]


I got this data extraction idea from here.

Once the data table is generated, now then save the data to a file with any extension .txt or .xls or .dat.

Export["C:/tcdata/myfile.txt", data, "Table"]


Now open Tecplot go to file menu and click on LoadDataFiles(s) and then upload your file named in this case myfile. From here on everything is straight forward. If you new to Tecplot, on net you can find tutorials.

To my liking, I reproduced this plot using Tecplot,