Displaying legends in displacement plot of Van der Pol oscillator on MATHEMATICA 8.0



I am trying to draw different plots of Van der Pol's oscillator displacement (ListPlots and ListLinePlots) using 'Show'. I have a problem drawing the legends. Here are my codes:

a1 = ListLinePlot[
   Table[{N[Subscript[x, i]], N[yle1Values[[i]]]}, {i, 1, Steps}]];

a2 = ListPlot[
   Table[{N[Subscript[x, i]], N[approx1[[i]]]}, {i, 1, Steps, 5}], 
   PlotMarkers -> {"o", 20}, PlotStyle -> {Red}];

a3 = ListPlot[
   Table[{N[Subscript[x, i]], N[yle11Values[[i]]]}, {i, 1, Steps, 
     13}], PlotMarkers -> {"\[CapitalDelta]", 20}, 
   PlotStyle -> {Blue}];

a4 = ListLinePlot[
   Table[{N[Subscript[x, i]], N[yle111Values[[i]]]}, {i, 1, Steps}], 
   PlotStyle -> {Purple}];

a5 = ListPlot[
   Table[{N[Subscript[x, i]], N[yle1111Values[[i]]]}, {i, 1, Steps, 
     5}], PlotMarkers -> {"+", 15}, PlotStyle -> {Blue}];

a6 = ListPlot[
   Table[{N[Subscript[x, i]], N[yle11111Values[[i]]]}, {i, 1, Steps, 
     23}], PlotMarkers -> {"\[RightTriangle]", 20}, 
   PlotStyle -> {Black}];

aaa = Show[a1, a2, a3, a4, a5, a6, 
  PlotLabel -> "Plots of t against y(t)", 
  AxesLabel -> {"Time t", "y(t)" }]

Here is my graph

enter image description here


Posted 2018-03-05T11:54:39.190

Reputation: 3


  • What version are you using? You seem to be on an older version of Mathematica. 2. Without definitions for the lists like yle1Values and yle11111Values, no one else will be able to evaluate your code and help you with your problem.
  • < – J. M.'s ennui – 2018-03-05T12:10:47.747

    @ J. M. I am using Mathematica. 8.0. I employed 'yle1Values and yle11111Values' as variables. They are not definitions. – Omojola – 2018-03-05T12:41:11.367

    The syntax yle1Values[[i]] in your code implies that yle1Values is a list whose i-th element you are extracting. You have that list, but the rest of us do not. – J. M.'s ennui – 2018-03-05T12:44:38.517

    @ J. M. That's true! It's a portion of my long code. You can make several plots yourself with the function 2 cos x. For variableness, you can make use of "2 cos x[[i]]+random numbers,{i,1,5}". Thank you. – Omojola – 2018-03-05T12:56:10.287

    @ J. M. yle1Values, yle11Values,... represent different results obtained by 6 various methods. So, I want to compare them on the graph. That, I have successfully done! I just want to add legends. – Omojola – 2018-03-05T13:15:26.577

    No answers