holoviews

Holoviews change datashader colormap

ぃ、小莉子 提交于 2021-01-27 07:26:32
问题 I'm trying to change the colormap used by datashader. I tried this: datashade(scatter, cmap='Reds') Where scatter is an hv.Scatter element. This doesn't work because datashader expects an iterable or a function that returns colors. As such, this works: datashade(scatter, cmap=['blue']) So how can I take the 'Reds' colormap and convert it into something datashader can use? Thank you. 回答1: Right; you can't pass the string name of a colormap to Datashader's cmap argument, because Datashader

Change the order of bars in a grouped barplot with hvplot/holoviews

烂漫一生 提交于 2021-01-24 07:03:21
问题 I try to create a grouped bar plot but can't figure out how to influence the order of the barplot. Given these example data: import pandas as pd import hvplot.pandas df = pd.DataFrame({ "lu": [200, 100, 10], "le": [220, 80, 130], "la": [60, 20, 15], "group": [1, 2, 2], }) df = df.groupby("group").sum() I'd like to create a horizontal grouped bar plot showing the two groups 1 and 2 with all three columns. The columns should appear in the order of "le", "la" and "lu". Naturally I'd try this

Change pandas plotting backend to get interactive plots instead of matplotlib static plots

我的未来我决定 提交于 2020-12-05 05:29:44
问题 When I use pandas df.plot() it has matplotlib as a default plotting backend. But this creates static plots. I would like interactive plots, so I have to change the pandas plotting background. How do I do change the plotting backend of pandas to have a different library creating my plots when i use .plot()? 回答1: You need pandas >= 0.25 to change the plotting backend of pandas. The available plotting backends are: matplotlib hvplot >= 0.5.1 holoviews pandas_bokeh plotly >= 4.8 altair So, the

How to control (active) tools in holoviews with bokeh backend

梦想与她 提交于 2020-07-10 01:06:23
问题 How do I control which tools are used / active in a holoviews plot with the bokeh backend? I've seen this SO answer, but that only adds a new active tool; it doesn't keep any other tools (e.g. pan) from being active. For a specific example, suppose I only want the hover tool. I would try doing this: import holoviews as hv hv.extension("bokeh") hv.Curve([1, 2, 3]).opts(tools=["hover"]) but then I end up with a plot that has hover in addition to the default tools. How do I specify the list of

How to control (active) tools in holoviews with bokeh backend

核能气质少年 提交于 2020-07-10 01:03:52
问题 How do I control which tools are used / active in a holoviews plot with the bokeh backend? I've seen this SO answer, but that only adds a new active tool; it doesn't keep any other tools (e.g. pan) from being active. For a specific example, suppose I only want the hover tool. I would try doing this: import holoviews as hv hv.extension("bokeh") hv.Curve([1, 2, 3]).opts(tools=["hover"]) but then I end up with a plot that has hover in addition to the default tools. How do I specify the list of

How to visualize time span with holoviews?

陌路散爱 提交于 2020-05-17 04:31:10
问题 I recently came across holoviews as promising visualization library in python and - as a practice - I wanted to transfer some of my existing code to see how it looks like in hv . I reached a given plot which I am unable to recreate. I'd like to visualize a timeline or roadmap where the x axis is with type of pd.datetime and the y is categorical. Something like this: What Element shall I use? How shall I define start and end position for sections? 回答1: This sounds like you need a Gantt chart .

Add text annotations to each data point in Holoviews plot

偶尔善良 提交于 2020-03-03 12:33:59
问题 In Bokeh I am able to add a text annotation to each point in my plot programmatically by using LabelSet . Below I give an example for a simple bar plot: import numpy as np import pandas as pd # Make some data dat = \ (pd.DataFrame({'team':['a','b','c'], 'n_people':[10,5,12]}) .assign(n_people_percent = lambda x: (x['n_people']/np.sum(x['n_people'])*100) .round(1).astype('string') + '%') ) dat # Bar plot with text annotations for every bar from bkcharts import show, Bar from bkcharts