0
$\begingroup$

I need to plot two lists of complex numbers in the same graph to show some results, so I'm using the following lists to do that:

modquaseesc = {-0.8880146641362043` - 
   0.5279941967067215` I,...}

listfreqgrav = {-1.9122901521705156` - 
       0.25201677748289864` I, -2.1321454971037404` - 
       0.27055536524472346` I,...}

And the following code to run a combined graph:

Show[{Transpose@Through@{Re, Im}@listfreqgrav;  ListPlot[coords, PlotStyle -> Directive[PointSize[Medium]],    PlotRange -> All, AxesLabel -> {"Re(\[Omega])", "Im(\[Omega])"},    PlotMarkers -> "*"], Transpose@Through@{Re, Im}@modquaseesc;  ListPlot[coords, PlotStyle -> Directive[PointSize[Medium]],   PlotRange -> Automatic,    AxesLabel -> {"Re(\[Omega])", "Im(\[Omega])"},   PlotMarkers -> "\[SmallCircle]"]}]

This way I get this Graph out of scale:

Image that I got!

Compare with the graphs separately, the graphs are different from each other: enter image description here

And:

enter image description here

Then, How could I generate a Graph with both plots saving the scale of each one?

Graciously! Thank you for supporting since now!

$\endgroup$
  • 1
    $\begingroup$ CaN you give more data points? I am unable to see a difference between the graphs. $\endgroup$ – Jack LaVigne Oct 17 '15 at 14:13
  • $\begingroup$ So @Jack, they're very large lists, I just provided a minimal example, but I can affirm that they different each other! :) $\endgroup$ – Herr Schrödinger Oct 17 '15 at 19:58
1
$\begingroup$

I made two fake data sets that were similar but not identical.

modquaseesc = Table[x + I (Exp[-Abs[x]] - 1), {x, -4, 4, 0.4}];
listfreqgrav = Table[x + I (Exp[-Abs[x + 1.]] - 1), {x, -4, 4, 0.4}]

Your code doesn't have coords defined. I am quite certain you meant to make that assignment in your first and third statements inside of Show. If you make those two assignments your code works fine.

However, I have some suggestions.

  1. I would recommend using With rather than defining coords inside Show.

  2. Once you define the AxesLabel in the first plot, it is not needed in the second plot.

  3. If you explicitly assign PlotMarkers as text, PointSize has no effect. Use Style instead.

  4. Either set PlotRange in the first plot or (better) set it as a command in Show.

  5. No need to provide Show with a list. It is happy with comma separated elements.

    With[
     {
      coords1 = Transpose@Through@{Re, Im}@listfreqgrav,
      coords2 = Transpose@Through@{Re, Im}@modquaseesc
      },
     Show[
      ListPlot[coords1,
       PlotMarkers -> Style["*", Red, 20],
       AxesLabel -> {"Re(ω)", "Im(ω)"}
       ],
      ListPlot[coords2,
       PlotMarkers -> Style["∘", Green, 20]
       ],
      PlotRange -> All
      ] 
     ]
    

Mathematica graphics

Edit

In order to get PlotLegends put everything inside a single ListPlot and use the labels you desire for the legend.

With[
 {
  coords1 = Transpose@Through@{Re, Im}@listfreqgrav, 
  coords2 = Transpose@Through@{Re, Im}@modquaseesc
  },
 ListPlot[{coords1, coords2},
  PlotRange -> All,
  PlotMarkers -> {Style["*", Red, 20], 
    Style["∘", Green, 20]}, 
  AxesLabel -> {"Re(ω)", "Im(ω)"},
  PlotLegends -> {"First", "Second"}
  ]
 ]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Hello @Jack, Thanks a lot for you Answer, It worked really well to me! I've got a graph with the two lists together, I appreciate your good will In helping us! Thak you again! :D $\endgroup$ – Herr Schrödinger Oct 17 '15 at 20:01
  • $\begingroup$ How could I insert legends in this graph? :) $\endgroup$ – Herr Schrödinger Oct 17 '15 at 20:11
  • $\begingroup$ I've edited the answer to show how to make a legend. You can also use Placed if you want the legends in a different position. $\endgroup$ – Jack LaVigne Oct 17 '15 at 22:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.