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

MATLAB removing text

  1. Oct 14, 2010 #1
    i'm using basic graphics on matlab where i use

    text(x,y,'text as string')

    to display text on a plot. is there a way to REMOVE this text? I tried overwriting it with ' ' and making the color white, font size 0, but none of these will remove the text.
  2. jcsd
  3. Oct 14, 2010 #2


    User Avatar
    Science Advisor

    If you use the following:
    >> h1 = text(x,y,'text as string')

    h1 will be an object handle to the text you just placed on your graph, allowing you to manipulate its properties, move it around, etc. You should also be able to delete it using the delete method:
    >> delete(h1)

    More documentation at the Mathworks website:

    I seem to recall that this should work, but don't have a copy of MATLAB at my work station.
  4. Oct 14, 2010 #3
    perfect solution, thanks
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook