0
$\begingroup$

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:

Needs["PlotLegends`"]
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

$\endgroup$
5
  • $\begingroup$ 1. 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. $\endgroup$ Mar 5 '18 at 12:10
  • $\begingroup$ @ J. M. I am using Mathematica. 8.0. I employed 'yle1Values and yle11111Values' as variables. They are not definitions. $\endgroup$
    – Omojola
    Mar 5 '18 at 12:41
  • $\begingroup$ 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. $\endgroup$ Mar 5 '18 at 12:44
  • $\begingroup$ @ 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. $\endgroup$
    – Omojola
    Mar 5 '18 at 12:56
  • $\begingroup$ @ 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. $\endgroup$
    – Omojola
    Mar 5 '18 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.