Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coord2norm not providing correct location to annotation built-in #7

Closed
sco1 opened this issue Jan 25, 2016 · 1 comment
Closed

coord2norm not providing correct location to annotation built-in #7

sco1 opened this issue Jan 25, 2016 · 1 comment
Assignees

Comments

@sco1
Copy link
Member

sco1 commented Jan 25, 2016

Passing normalized coordinates to annotation does not produce the axes position for the annotation.

For example:

myaxes = axes();
x = 0:10;
plot(x, x);

[normx, normy] = coord2norm(myaxes, 2, 6);

dim = [normx normy .3 .3];
mystr = 'This is plot 1';
annotation('textbox', dim, 'String', mystr, 'FitBoxToText', 'on');

Rather than placing the corner of the text box at [2, 6] as desired, the annotation is placed around [2, 9].

sample1

However, the norm2coord inverse provides the correct location:

hold on
[coordx, coordy] = norm2coord(myaxes, normx, normy);
plot(coordx, coordy, 'o');

sample2
hold off

@sco1 sco1 added the bug label Jan 25, 2016
@sco1 sco1 self-assigned this Jan 25, 2016
@sco1 sco1 removed the bug label Jan 25, 2016
@sco1
Copy link
Member Author

sco1 commented Jan 25, 2016

This is an issue with the 'FitBoxToText' property of the annotation edit box. If you set this property to the default 'off', the box is positioned appropriately on the figure:

myaxes = axes();
x = 0:10;
plot(x, x);

[normx, normy] = coord2norm(myaxes, 2, 6);

dim = [normx normy .3 .3];
mystr = 'This is plot 1';
annotation('textbox', dim, 'String', mystr);

sample

However, when resizing the border to the text, the annotation object is not repositioned to account for the border change. As this is an internal MATLAB issue this is beyond the scope of the functions in this repo.

@sco1 sco1 closed this as completed Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant