figure(2) never appears.
6 views (last 30 days)
Show older comments
Vivek Bhargava
on 31 May 2020
Answered: Vivek Bhargava
on 3 Jun 2020
In my code i have nxn correlation matrix (named R) and i use heatmap function to plot the heatmap.
I then have another 6-7 graphs.
Issue - When is use figure(2) for my second plot nothig appears for figure (2) (keeping others named as 3,4,5 - they appear properly though).
However, if I use figure(3) after the heatmap, i get figure 1 as my heatmap, then figure 3 as my next figure and so on - the other figures pop up nicely.
But this figure (2) is a nightmare, even if I delete the heatmap portion from the code and I just plot figure(2) for my graph it appears as figure(1) but not as figure (2).
If I give it a random number as figure (11) the graph appears as figure 11. BUT IT DOESNT APPEAR AS FIGURE(2).
Any advice on this will be highly appreciated. Thanks
ALSO, I cannot access the properties of heatmap from the command window - it says " Unable to display properties for variable f because it refers to a deleted object"
attaching some part of the code -
figure(1)
f = heatmap(Z)
.
.
.
BELOW works as figure(3) but not if i say figure (2)
figure(3)
X1 = min(X_train_best2(:,2)):.1:max(X_train_best2(:,2));
X2 = min(X_train_best2(:,3)):.1:max(X_train_best2(:,3));
[X1,X2] = meshgrid(X1,X2);
Z = beta_OLS_best2 (1) + X1 * beta_OLS_best2 (2) + X2 * beta_OLS_best2 (3);
mesh(X1,X2,Z,'EdgeColor','interp');
hold on;
scatter3(X_train_best2(:,2),X_train_best2(:,3), Y_train_best2,20, 'MarkerFaceColor', [1,0,0])
title('predicted price (regression plane - training data) - best 2 covariates case')
hold off;
0 Comments
Accepted Answer
Image Analyst
on 31 May 2020
Try not giving it a number. Try just getting the handle:
hFig1 = figure;
hFig1.WindowState = 'maximized' % Maximize the first figure.
hFig2 = figure;
hFig3 = figure;
hFig4 = figure;
% Now switch focus (default/current figure) to hFig1.
figure(hFig1);
% Plot something on figure 2.
% Now switch focus (default/current figure) to hFig2.
figure(hFig2);
% Plot something on figure 2.
Give your complete code if that doesn't work (but it will since that's what I always do).
0 Comments
More Answers (1)
See Also
Categories
Find more on Data Distribution Plots 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!