Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
2  
You just need to add Exclusions -> None to your plot command. Also, the documentation covers this very example –  rm -rf Sep 26 '12 at 0:40

2 Answers 2

up vote 9 down vote accepted

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

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

From the help:

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

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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