Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica - Axes Plotting (simple!)

  1. Feb 28, 2010 #1
    Hi there,

    Making a nice visual for a quantum problem, which is finding the probability of finding the object outside of the classically allowed region for n=0,1,2. One problem: How do I make the y-axis stop after the origin so it doesn't mess up my arrows or my text (see attached)?

    Any other advice to spiffy up this graph? Thanks :)


    Attached Files:

    • QHO1.pdf
      File size:
      67.8 KB
  2. jcsd
  3. Feb 28, 2010 #2
    Check out the neat examples in the help file for Plot, they do more or less the exact same thing. Another way to maybe spruce it up is go Frame->True
  4. Feb 28, 2010 #3
    Yes that's the first place I went, but I couldn't make sense of it. Can anyone help?

  5. Mar 2, 2010 #4


    User Avatar
    Gold Member

    You can try Epilog to hide it :

    XX = Plot[0.9 - Sin[x]^2 , {x, -10, 10}, Epilog -> {White, Rectangle[{-1, -0.5}, {1, 0}]}]

    This basically plots the function, then makes a white rectangle at the location, covering the axis after it has been drawn.

    I looked for axis options, but theres nothing, and even changing your plot range is finicky and works or doesn't depending on other graphics and labels.
    There are a lot of "directives" that work with Plot, but aren't listed in Plot's Help.
  6. Mar 2, 2010 #5
    Thanks for the reply Hepth. The problem with that is that it will also white out all my other graphics at that location, including lines, text etc., and I can't figure out how to make it "send to back"
  7. Mar 2, 2010 #6


    User Avatar
    Gold Member

    Are you using SHOW? I think it automatically draws stuff in order of back to front.

    XX = Plot[Sin[x], {x, 0, 1}];
    Show[Graphics[Rectangle[{0, 0}, {1, 0.5}]], XX,
    Graphics[{Thick, Orange, Circle[{0.5, 0.5}, 0.1]}]]

    If you change the order of SHOW itll stack them.

    So don't even use prolog or epilog, just use SHOW for all your graphics and use the ordering there.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook