jupyter-scatter icon indicating copy to clipboard operation
jupyter-scatter copied to clipboard

Axis tick values not accurate

Open jykr opened this issue 3 years ago • 4 comments

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)

jykr avatar Jul 29 '22 05:07 jykr

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 avatar Jul 29 '22 12:07 flekschas

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 avatar Aug 01 '22 23:08 flekschas

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

flekschas avatar Aug 02 '22 00:08 flekschas

It works! Thanks for the quick fix!

jykr avatar Aug 02 '22 19:08 jykr

Thanks for testing! I am closing the issue now.

flekschas avatar Oct 04 '22 18:10 flekschas