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

Axis tick values not accurate #36

Closed
jykr opened this issue Jul 29, 2022 · 5 comments
Closed

Axis tick values not accurate #36

jykr opened this issue Jul 29, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@jykr
Copy link

jykr commented Jul 29, 2022

Hi, thanks so much for developing this wonderful package! It's been extremely helpful, and I'd like to report some bug that I encountered.

I often find the tick label value is different from what I get from the selection. Moreover, the tick label value is not properly adjusted as I zoom in and out.
For example, the following point which should be close to (0, 0) would move further from the origin when I zoomed out.

image
image

I'm using the following code to generate above plot.

# scatterplot 
scatter = jscatter.Scatter(data=plot_df, x='A', y='B', color_by="group", 
                 width=500, height=500, opacity=0.5)
# output area to display dataframe
out = widgets.Output()

# handler for when "selection" changes from scatterplot
def on_change(change):
    out.clear_output()
    with out:
        indicies = change["new"]
        subset = plot_df.iloc[indicies]
        display(subset)
        
# add change handler to scatterplot widget. 
# `on_change` runs every time the `scatterplot.widget.selection` changes

scatter.size(by='rate', norm=(-0.2, 1))
scatter.color(map = {"NegCtrl":"grey", "PosCtrl_inc":"red",
                         "PosCtrl_dec":"blue", "Variant":"green"})
scatter.widget.observe(on_change, names='selection')
scatter.axes(True, True, labels=True)
scatter.legend(True, position='top-left')
display(scatter.show(), out)
@flekschas flekschas added the bug Something isn't working label Jul 29, 2022
@flekschas
Copy link
Owner

Thank you for reporting the issue! That's definitely a bug. Which version of jupyter-scatter and browser are you using?

I'll try to get this fixed over the weekend.

@flekschas
Copy link
Owner

I found the issue, it's caused by setting a dedicated width. When I remove width=500 the problem seems to be gone. I'll get started working on a fix.

@flekschas
Copy link
Owner

A fix is about to be released. Can you check that v0.7.1 fixes the issue for you?

@jykr
Copy link
Author

jykr commented Aug 2, 2022

It works! Thanks for the quick fix!

@flekschas
Copy link
Owner

Thanks for testing! I am closing the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants