Legend Positioning / Re-size Bug in R2014b?

When I execute the following code I am unable to select the legend object and re-size it using the mouse by grabbing the handles and dragging it. Even re-positioning the legend becomes problematic using the mouse. It appears to be connected to the two "set" commands. If the set commands are commented out then I have no issues with positioning or re-sizing the legend. Does anybody else have this problem?
hf2 = figure(2);
set(gcf,'units','inches')
set(gcf,'position',[0.5 0.5 5.5 4])
plot(rand(5,5))
legend('1','2','3','4','5')

1 commentaire

Adam
Adam le 7 Nov 2014
Same behaviour for me on resizing (something I never do anyway, but I also never use inches if that is the cause).
Moving is no problem though as that is done without having to go into selection mode, it just drags around as normal in standard mode.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 7 Nov 2014

0 votes

I didn't even know you could do that since I almost always do things programmatically rather than interactively, but it works fine for me in R2014b. I can click and drag the legend box to a new precise position with absolutely no problems.

6 commentaires

John
John le 7 Nov 2014
Interesting. Adam (above) seemed to replicate the problem. Perhaps it is a specific issue with my graphics hardware (I am forced to use opengl 'software' on my system).
matt dash
matt dash le 7 Nov 2014
Does it work if you set the figure renderer to 'painters'? (Ps it works just fine for me too, although in other situations i have run into new bugs in 2014b where matlab fails to correctly identify which object is under the cursor, which effectively disables click-and-drag capabilities)
Adam
Adam le 7 Nov 2014
Well, note Image Analyst said he can click and drag to a new location. I also said I could do that, but that in selection mode I could not resize, which Image Analyst didn't comment on.
matt dash
matt dash le 7 Nov 2014
Oh I see... you mean like in "Property Editor" mode? In that case i see the same behavior you describe. Unfortunately it looks like all the legend functions are pcode so you can't see what's going on inside. Might be a bug.
If the arrow icon is not pushed in, I can drag it around. If the arrow icon is pushed in, I get resizing handles but can't resize it or move it. I can set the font size in advance doing this:
set(gca, 'FontSize', 30);
legend('1','2','3','4','5')
John
John le 10 Nov 2014
I can also drag it around if the arrow icon is not pushed in. If the arrow icon is pushed in I can drag it around if it the FIRST thing I select. If you then release the mouse button you cannot immediately select the legend again and drag it. But if you click somewhere else in the figure (so that the handles on the legend disappear) then come back to the legend you can drag it around again. In any case, I did report this as a bug to Tech Support and they acknowledged it as a known issue with R2014b which will be fixed in a future release. In the meantime, the only way to re-size the legend is by manually specifying its 'position' property or modifying its position through the property editor. Thanks for all of the answers!

Connectez-vous pour commenter.

Question posée :

le 7 Nov 2014

Commenté :

le 10 Nov 2014

Community Treasure Hunt

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

Start Hunting!

Translated by