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

Scalebar does not display upon mirroring axis #2557

Closed
LMSC-NTappy opened this issue Oct 6, 2020 · 2 comments
Closed

Scalebar does not display upon mirroring axis #2557

LMSC-NTappy opened this issue Oct 6, 2020 · 2 comments

Comments

@LMSC-NTappy
Copy link
Contributor

Upon mirroring an axis, the scalebar on the display does not display anymore.

#generate a sample gaussian lineshape dataset
shape = (8,4,1000)
dat = np.zeros(shape)
for i in range(shape[0]):
    for j in range(shape[1]):
        dat[i,j,:] = np.histogram(np.random.normal(360,8,int(1e5)),bins=1000,range=(300,800))[0].astype('int32')
ax0 = {'size': shape[1], 'name':'X', 'units':'um', 'scale':1.05, 'offset':0, 'navigate': True}
ax1 = {'size': shape[0], 'name':'Y', 'units':'um', 'scale':1.05, 'offset':0, 'navigate': True}
ax2 = {'size': 1000, 'name':'WL', 'units':'nm', 'scale':0.5, 'offset':300, 'navigate': False}

a = hs.signals.Signal1D(dat,axes=[ax1,ax0,ax2])
a.metadata.General.title = "a"

b = a.inav[:,::-1]
b.metadata.General.title = "b"

a.plot(scalebar=True)
b.plot(scalebar=True)

image

The annotation position must not be adapted to the new axis values. I've noticed that upon running

bprime = a.inav[:,::-1]
bprime.axes_manager[1].scale = a.axes_manager[1].scale
bprime.axes_manager[1].offset = a.axes_manager[1].offset
bprime.metadata.General.title = "b prime"

bprime.plot()

The bug disappears

image

Any insight on how to patch this? It's probably a simple trait update missing but I couldn't find it.
Also, possible link with #1228 ?

Best Regards

Nico

@ericpre
Copy link
Member

ericpre commented Oct 8, 2020

Could it because the two axis doesn't have the same scale anymore? One of the two in b is now negative?

@ericpre
Copy link
Member

ericpre commented Oct 8, 2020

#1228 should be a different issue to do with how the scale bar is anchored or not, or something along these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants