Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Location of widgets #78

Open
bacalfa opened this issue Mar 16, 2018 · 8 comments
Open

Location of widgets #78

bacalfa opened this issue Mar 16, 2018 · 8 comments

Comments

@bacalfa
Copy link

bacalfa commented Mar 16, 2018

Is it possible to set the location of widgets? For example, I'd like to place dropdown lists, sliders, etc. to the right of a plot. The example below displays them on top (and left-aligned).

Also, if there's a better way of coding it, please let me know!

import numpy as np
import pandas as pd

import holoviews as hv
hv.extension("bokeh")
renderer = hv.renderer("bokeh")
# Remove Bokeh logo from plots (https://stackoverflow.com/questions/47585887/remove-bokeh-logo-in-holoviews)
def disable_logo(plot, element):
    plot.state.toolbar.logo = None
hv.plotting.bokeh.ElementPlot.finalize_hooks.append(disable_logo)
import param, paramnb

df = pd.DataFrame({"pax": ["a", "b", "c"], "val": [3, 1, 2], "day": ["Wednesday", "Thursday", "Friday"]})

def make_Bars(pax):
        if pax != "ALL":
            df_tmp = df[df["pax"] == pax]
        else:
            df_tmp = df
        return hv.Bars(df_tmp, kdims=["day"], vdims=["val"])

class Test(hv.streams.Stream):
    pax = param.ObjectSelector(default="ALL", objects=["ALL"] + np.unique(df["pax"]).tolist())

    def view(self, **kwargs):
        return hv.DynamicMap(make_Bars, kdims=[], streams=[self])

explorer = Test(name="Test")
paramnb.Widgets(explorer, callback=explorer.event, on_init=True)
explorer.view()

image

@bacalfa
Copy link
Author

bacalfa commented Apr 2, 2018

Any help? :)

@jbednar
Copy link
Member

jbednar commented Apr 2, 2018

We have a lot of work to do to make this more configurable, but for now you can use a View parameter to determine the position.

@philippjfr
Copy link
Member

ParamBokeh allows passing in an explicit list of plots, I'd be happy to port that to paramNB.

@bacalfa
Copy link
Author

bacalfa commented Apr 2, 2018

I switched to paramnb because I was having issues with parambokeh (https://stackoverflow.com/questions/49205055/holoviews-dynamicmap-with-mixed-widgets)...

@philippjfr
Copy link
Member

That link isn't working for me.

@bacalfa
Copy link
Author

bacalfa commented Apr 2, 2018

@bacalfa
Copy link
Author

bacalfa commented Apr 4, 2018

I think this is related, but is there a way to specify the order of the widgets? I have 4 dropdown lists, and it seems they're displayed in alphabetical order. I'd like to set the order from top to bottom.

@philippjfr
Copy link
Member

You can define precedence on the parameters which determines their order.

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

No branches or pull requests

3 participants