Changes

Jump to navigation Jump to search
no edit summary
Line 7: Line 7:  
* gca() (the handle to the axes inside a particular figure (several if you have subplots)  
 
* gca() (the handle to the axes inside a particular figure (several if you have subplots)  
 
* p=plot(x,y) (p is the handle (inside the current axes handle) to the data, data symbols, data line thickness, etc)
 
* p=plot(x,y) (p is the handle (inside the current axes handle) to the data, data symbols, data line thickness, etc)
 +
* t=text(xlocation,ylocation,'some text') (t is the handle to the text and is a child of the current axes handle, like p)
 +
* pp=patch([x1 x2 x3 x4], [y1 y2 y3 y4], 'r') (pp is the handle to a red patch using the coordinates inside the current axes handle)
    
Let's do an example:
 
Let's do an example:
Line 52: Line 54:  
Adding {{Codeline|text()}} inside an {{Codeline|axes()}} object is done by
 
Adding {{Codeline|text()}} inside an {{Codeline|axes()}} object is done by
 
  text(2,0.8,'HERE');
 
  text(2,0.8,'HERE');
... but it now inserted in figure1, which ''might NOT be want you anticipated''.
+
... but it now is inserted in figure1, which ''might NOT be want you anticipated''.
 
   
 
   
 
The {{Codeline|text()}} command does ''not'' have the option to tell it in which figure or axes object to write the text.  
 
The {{Codeline|text()}} command does ''not'' have the option to tell it in which figure or axes object to write the text.  
Make sure you have moved current figure and axes ''before'' calling {{Codeline|text()}} to insert text:
+
Make sure you have moved to current figure and axes ''before'' calling {{Codeline|text()}} to insert text:
  figure(2)
+
  figure(2) % the following command will operate on figure(2)
  get(gcf(),'children') % which two axes objects are there inside figure(2)
+
  get(gcf(),'children') % which two axes objects are there inside the current figure ?
  set(gcf(),'currentaxes',(get(gcf(),'children'))(2)) % chose the second one
+
  set(gcf(),'currentaxes',(get(gcf(),'children'))(2)) % chose the second set of axes
 
  text(1.0,0.5,'THIS IS WHAT I WANTED')
 
  text(1.0,0.5,'THIS IS WHAT I WANTED')
22

edits

Navigation menu