Removing Text in MATLAB Graphics

  • Context: MATLAB 
  • Thread starter Thread starter quantum13
  • Start date Start date
  • Tags Tags
    Matlab Text
Click For Summary
SUMMARY

To remove text from a MATLAB plot, utilize the object handle created when the text is added. By executing h1 = text(x,y,'text as string'), you can store the handle in h1. The text can then be deleted using the command delete(h1). This method is definitive and effective for managing text objects in MATLAB graphics.

PREREQUISITES
  • Familiarity with MATLAB graphics functions
  • Understanding of object handles in MATLAB
  • Basic knowledge of MATLAB syntax
  • Access to MATLAB documentation for reference
NEXT STEPS
  • Explore MATLAB text object properties
  • Learn about MATLAB graphics object manipulation
  • Investigate advanced plotting techniques in MATLAB
  • Review the MathWorks documentation on the delete method
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in data visualization and graphical representation, including data scientists and engineers working with MATLAB graphics.

quantum13
Messages
65
Reaction score
0
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.
 
Physics news on Phys.org
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:
http://www.mathworks.com/help/techdoc/ref/delete.html
http://www.mathworks.com/help/techdoc/ref/text.html

I seem to recall that this should work, but don't have a copy of MATLAB at my work station.
 
perfect solution, thanks
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 23 ·
Replies
23
Views
5K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K