0

I have saved a figure, foo.fig, in Matlab, which contains subplots. I later want to open it and change the y-axes on each subplot. For example, say I want to change the axes of subplot 2:

hgload('Belle_8_8_14_ch3.fig');
subplot(5,4,2)
set(gca, 'YLim', [0 1])

The problem is, when I call subplot everything in panel 2 is overwritten. How do I stop this?

I have lots of these plots, so I cannot do it simply by clicking and changing them manually with the GUI.

Note this is only a problem with a figure I have saved and reopened, but unfortunately I need to do this for this application.

Related content

http://www.mathworks.com/matlabcentral/answers/85219-subplot-of-already-saved-figures

eric
  • 7,142
  • 12
  • 72
  • 138
  • This is answered [here](https://www.mathworks.com/matlabcentral/newsreader/view_thread/236202). – AnonSubmitter85 Sep 17 '14 at 19:56
  • So there is no way to do it cleanly, without creating a new figure and copying its contents over? Maybe there is a better way to do it since that 2008 post came out :) – eric Sep 17 '14 at 20:07
  • You didn't read the post. It tells you to use `findobj` to get the handle and then set the current axes to it. – AnonSubmitter85 Sep 17 '14 at 20:14
  • @NKN that doesn't help. The second you do subplot(x,y,z), panel z is overwritten completely. – eric Sep 17 '14 at 20:19
  • Anon how to find handle corresponding to particular subplot? – eric Sep 17 '14 at 20:31
  • Something like `get( gca(), 'children' )`. – AnonSubmitter85 Sep 17 '14 at 20:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61448/discussion-between-neuronet-and-anonsubmitter85). – eric Sep 17 '14 at 20:40
  • [This post is also somewhat related](http://stackoverflow.com/questions/25378680/saving-a-matlab-figure-and-keeping-all-handles/25380289#25380289) – Dev-iL Sep 22 '14 at 16:41

0 Answers0