3
$\begingroup$

Would someone mind showing me how to plot a floor function with the appropriate endpoints? I tried Google, but the best I could find was something posted from 2004 that no longer appears to work.

Sorry if this is overly basic, I've only got a couple of weeks of experience with Mathematica and no one to work with on it.

Edit: I'm looking to create a graph similar to the one shown on the wiki page for floor/ceiling functions. I'm not too concerned with the frame or the tick marks.

$\endgroup$
  • 2
    $\begingroup$ You just need to add Exclusions -> None to your plot command. Also, the documentation covers this very example $\endgroup$ – rm -rf Sep 26 '12 at 0:40
10
$\begingroup$

To plot $\lfloor x\rfloor$ you can use DiscretePlot at the integers with ExtentSize and ExtentMarkers:

DiscretePlot[Floor[x], {x, 0, 8}, ExtentSize -> Right, 
 ExtentMarkers -> {"Filled", "Empty"}, Filling -> None]

enter image description here

$\endgroup$
  • $\begingroup$ Sadly this doesn't work on v7, which explains why I haven't used these options before. :-/ $\endgroup$ – Mr.Wizard Sep 26 '12 at 2:58
  • $\begingroup$ @Mr.Wizard Yes, the Extent* options were added in V8. $\endgroup$ – Brett Champion Sep 26 '12 at 3:07
2
$\begingroup$

From the help:

Plot[Floor[x], {x, 0, 10}, ExclusionsStyle -> {Red, Blue}]

Mathematica graphics

$\endgroup$

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.