hvplot

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

Adding value labels to hvplot.bar

梦想的初衷 提交于 2020-01-25 00:19:10
问题 Using the hvplot tutorial we are trying to generate a bar plot with values as labels on the bars itself. The bar plot is generated using the following code import dask.dataframe as dd import hvplot.pandas df = dd.read_parquet('data/earthquakes.parq').persist() df.magType.value_counts().compute().to_frame().hvplot.bar() How can we add the value of the bars on the bar itself? 回答1: Use holoviews hv.Labels() to add value labels to your data. You create the labels separately and use the * symbol

Install the latest git versions of holoviews, hvplot, panel, datashader and param

纵饮孤独 提交于 2020-01-22 02:23:09
问题 The libraries of the Holoviz ecosystem are continuously updated. Using pip, how do I install the latest git versions of: Holoviews Hvplot Panel Datashader Param 回答1: The latest github versions of the holoviz libraries can be installed as follows. Holoviews: pip install git+https://github.com/holoviz/holoviews.git Hvplot: pip install git+https://github.com/holoviz/hvplot.git Panel: pip install git+https://github.com/holoviz/panel.git Datashader: pip install git+https://github.com/holoviz

Overlay NdOverlays while keeping color / changing marker

大兔子大兔子 提交于 2019-12-24 20:43:37
问题 I want a scatter plot of different types of "asset", each asset should have the same color and labeled in the legend. I can do this using an NdOverlay of Scatter. Then I want to overlay two such plots, eg one coming from a model and another from experiment, so that the first and second only change in marker but keeps the same color for each asset. I would expect this to work df1 = pd.DataFrame({"asset": ["A", "B", "B"], "x": [1,2,3], "y": [1,2,3]}) df2 = pd.DataFrame({"asset": ["A", "B", "B"]

Holoviews color per category

被刻印的时光 ゝ 提交于 2019-12-11 02:37:27
问题 I have been lately working with bokeh for plotting. I just found out about holoviews and wanted to plot a basic box plot. In my box plot I am trying to color per one of the categories I am grouping the data in. Here is the code I am using: hv.extension('bokeh') %opts BoxWhisker (box_color='blue') boxwhisker = hv.BoxWhisker(pool_ride_distance_time_year_less_hour, ['total_time', 'customer'], 'amount') plot_opts = dict(show_legend=False, width=800, height=400) I am trying to color it differently