0
$\begingroup$

I have this picture of a residual Plot I am trying to reproduce (Y axis scale should be the same as in my plot):

Reference graph

The code I have used is:

DiscretePlot[ResN[[i]], {i, 1, 10}, Joined -> True, Filling -> None, 
     PlotMarkers -> "Point", PlotRange -> {{0, 15}, {0, 1}}, 
     PlotLabel -> "Res(n)"]`

Plot with the Y-axis to be modified to agree with upper graph

ResN is a List with values for ten columns.

Any help would be appreciated. I browsed around for the answer, but without any success.

$\endgroup$
3
  • 1
    $\begingroup$ Have you seen ListLogPlot? $\endgroup$
    – N.J.Evans
    Commented Apr 20, 2015 at 20:56
  • $\begingroup$ @NJEvans: Yes, I have, but it is not working in my case, because 'ResN' is not a rule ar a list of rules. Sektor: thank you for edit! $\endgroup$
    – Mike
    Commented Apr 20, 2015 at 21:13
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) 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! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$
    – bbgodfrey
    Commented Apr 20, 2015 at 21:41

1 Answer 1

2
$\begingroup$
myRes[n_] := 1/n^3;
myFig = ListLogPlot[Table[{n, myRes[n]}, {n, 1, 10}],
  PlotLabel -> Text[Style["Res(n)", 18]],
  PlotRange -> {Automatic, {10^(-8), 100}},
  Joined -> True,
  Ticks -> {Automatic, 
    Table[{10^i, "1. E " <> ToString[i]}, {i, -8, 2, 2} ]}]

enter image description here

$\endgroup$
3
  • $\begingroup$ Your comment was very valuable. However, I had to change the definition of my ResN variable to be a List type. I made this with the use of Range. Now I can use ListLogPlot to plot the data. How could I modify your plot to have a value of 1 plotted at the 0 value of the abscisa axis (not at 1 as in thisa case)? $\endgroup$
    – Mike
    Commented Apr 21, 2015 at 5:28
  • $\begingroup$ Solved the problem with setting PlotMarkers-->Automatic. $\endgroup$
    – Mike
    Commented Apr 21, 2015 at 5:41
  • $\begingroup$ @Mike Res[n_] := 1/(n+1)^3 and Table[..., {n, 0, 10}]. $\endgroup$ Commented Apr 21, 2015 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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