Take a look at the following; my discrete points are chopped because of my choice of vertical plot range. If I increase that plot range to include my discrete points, I lose my "m" at the origin because the y-axis extends into the negative. I want both "complete points" and my "m". I tried preventing the y-axis from going negative and increasing the tick to tick label distance as describe in various SE posts, but was unsuccessful on both counts. (I was unable to use FrameMargins at the same time as specifying tick label names.) Best regards...

a = -6.13;
b = 6.13;
c = 0.0000001;
f[x_] := Abs[Sin[(π*(x - c))]/(π*(x - c))];
p = Table[{x, f[x]}, {x, -5, 5, 1}];
Show[Plot[f[x], {x, a, b}, PlotRange -> {{a, b}, {-0.0062, 1.1}},
  Ticks -> {{{-1.0, "m-1"}, {-5.0, "m-5"}, {0.0, "m"}, {5.0, 
      "m+5"}, {1.0, "m+1"}}, {{1.0, "A "}}}],
  DiscretePlot[f[x], {x, Floor[a], Floor[b], 1.0}, 
  PlotStyle -> Darker[Red]]]

Composite Plot, Tick labeling, Ranging

  • $\begingroup$ By the way, is there a better way to post a plot? This one looks fuzzy. $\endgroup$ – user3037959 May 1 '19 at 17:11
  • $\begingroup$ I usually use the Export[] command for graphs and add the option to increase image resolution like: Export["~/Desktop/plot1.png", plot1, ImageResolution -> 300]. That usually results in fairly crisp plots in my opinion. $\endgroup$ – MassDefect May 1 '19 at 17:50
  • $\begingroup$ Nice! I'll do the same next time. Thanks... $\endgroup$ – user3037959 May 2 '19 at 6:11

Use PlotRangeClipping->False to avoid chopping the points. Also, the location of the dots could be improved by using an AxesOrigin option. The options should go either in the first plot, or as an option to Show:

    Plot[f[x], {x,a,b}, 
        PlotRange->{{a,b}, {-0.0062,1.1}},
            {{1.0,"A "}}
    DiscretePlot[f[x], {x, Floor[a], Floor[b], 1.0}, PlotStyle->Darker[Red]],
    AxesOrigin -> {0, -.0062}

enter image description here

  • $\begingroup$ Excellent - many thanks. $\endgroup$ – user3037959 May 2 '19 at 6:10

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.