inset of matlab figure inside the figure doesnot show new axes label

3 views (last 30 days)
Here is the code I used:
figure (3)
plot(total_cellcount.time,(prolif.')./total_cellcount.sum_sum_cell_count,'o')
xlabel('Time');
ylabel('No. prolif. cells/total No. cells')
axes('Position',[.7 .7 .2 .2])
box on
plot(total_cellcount.time,prolif,'o')
xlabel('Time');
ylabel('No. prolif. cells')
The axes label of inset figure is the same as the main figure. How can I fix it?
  1 Comment
dpb
dpb on 18 Aug 2019
Edited: dpb on 19 Aug 2019
Looks OK here...need enough to duplicate the issue. Have a feeling the figure you generated didn't come from the code above in its entirety...particularly since there's nothing to have generated the data it has to be only a piece.
In general when using multiple axes, save the axes handle to each figure and ensure are plotting into the desired axis. Probably (altho we can't see it here) your actual problem figure has had something else happen that changed focus so that you wrote to the other axes handle than you expected.
Execute close 3 and then only the above code and see if symptoms don't change. But still, save the handles of the two axes when you create them and then use that axis as the target for the various plotting instructions instead of default.

Sign in to comment.

Accepted Answer

Urmila Rajpurohith
Urmila Rajpurohith on 21 Aug 2019
When using multiple axes in a figure return the Axes objects as hAx1,hAx2
hFig=figure (3)
hAx1=axes(Parent,hFig)
plot(hAx1,total_cellcount.time,(prolif.')./total_cellcount.sum_sum_cell_count,'o')
xlabel(hAx1,'Time');
ylabel(hAx1,'No. prolif. cells/total No. cells')
hAx2=axes('Position',[.7 .7 .2 .2])
box on
plot(hAx2,total_cellcount.time,prolif,'o')
xlabel(hAx2,'Time');
ylabel(hAx2,'No. prolif. cells')
You can refer to the following documentation link for more information regarding "Axes properties".

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!