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

Autoranging on multi-line plots limits view to a single line #6033

Closed
1 task
droumis opened this issue Nov 4, 2023 · 11 comments · Fixed by #6173
Closed
1 task

Autoranging on multi-line plots limits view to a single line #6033

droumis opened this issue Nov 4, 2023 · 11 comments · Fixed by #6173
Assignees
Labels
type: bug Something isn't correct or isn't working

Comments

@droumis
Copy link
Member

droumis commented Nov 4, 2023

ALL software version info

Python : 3.10.13 | packaged by conda-forge | (main, Oct 26 2023, 18:09:17) [Clang 16.0.6 ]
Operating system : macOS-13.5.2-arm64-arm-64bit
Panel comms : default

holoviews : 1.18.0
bokeh : 3.3.0
hvplot : 0.9.0
jupyterlab : 4.0.7

Description of expected behavior and the observed behavior

Interacting, via zoom or pan, on a plot with multiple lines limits the viewport to a single line if autorange='y' is set.

Complete, minimal, self-contained example code that reproduces the issue

import pandas as pd
import numpy as np
import hvplot.pandas

length = 100
parameters = [
    (0, 1),      # Mean 0, SD 1
    (100, 20),   # Mean 100, SD 20
    (1000, 200), # Mean 1000, SD 200
    (-500, 50)   # Mean -500, SD 50
]

df_ = pd.DataFrame({f"{i}": np.random.normal(mean, sd, length) for i, (mean, sd) in enumerate(parameters)})
df_ = df_.reset_index().melt(id_vars=['index'], var_name='source', value_name='value')
df_['source'] = df_['source'].astype(int)

# Single Line Plot
s = df_.hvplot(x="index", y="value", downsample=True, autorange='y').opts(width=450, shared_axes=False)

# Multi Line Plot
m= df_.hvplot(x="index", y="value", by='source', downsample=True, autorange='y').opts(show_legend=False, width=450, shared_axes=False)

s + m

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

Screen.Recording.2023-11-04.at.8.52.35.AM.mov
  • I may be interested in making a pull request to address this
@droumis droumis added the TRIAGE Needs triaging label Nov 4, 2023
@maximlt maximlt added type: bug Something isn't correct or isn't working and removed TRIAGE Needs triaging labels Nov 8, 2023
@droumis
Copy link
Member Author

droumis commented Dec 14, 2023

And autorange=y does not seem to work at all with multiple lines using just HoloViews:

import holoviews as hv; hv.extension('bokeh')
import numpy as np

np.random.seed(42)
ys = np.random.randn(101).cumsum(axis=0)

curve = hv.Curve(ys) * hv.Curve(ys[::-1])
curve.opts(autorange='y')
Screen.Recording.2023-12-14.at.2.11.23.PM.mov

@droumis droumis transferred this issue from holoviz/hvplot Dec 14, 2023
@droumis
Copy link
Member Author

droumis commented Jan 30, 2024

Update from @jlstevens:

Together with @maximlt, they found out there is a more general problem with autoranging and overlays that is probably the cause; probably a regression since the multi-axis work. As such it will need to be fixed for the next holoviews release.

@jlstevens will have another look this week

@droumis
Copy link
Member Author

droumis commented Feb 5, 2024

@jlstevens, any update from last week?

@jlstevens
Copy link
Contributor

I'm currently working on it - unfortunately, this is a really tricky bit of code!

@droumis
Copy link
Member Author

droumis commented Mar 4, 2024

Hi @jlstevens, could you provide a status update on this?

@jlstevens
Copy link
Contributor

I had to step away from my debugging attempts for a while but I can now look into this once more. My goal is to open a PR this week. Thank you for the reminder!

@droumis
Copy link
Member Author

droumis commented Apr 2, 2024

Hi @jlstevens, any progress on that PR?

@jlstevens
Copy link
Contributor

Sorry I got distracted by other priorities once again. Perhaps there is someone else who could be assigned to work together with me on this? That will help keep me on track and help get this fixed faster.

@philippjfr
Copy link
Member

Turned out to be a small oversight in the existing implementation, so I fixed it.

@jlstevens
Copy link
Contributor

jlstevens commented Apr 4, 2024

Thank you!

I really thought I had to do something in the Python code to accumulate over the elements of the overlay. I realize my mental model of how the callback was looping over elements was wrong.

Anyway, I'm just glad it is fixed :-)

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants