holoviews

How do I manually set the tick locations of a colorbar for a Points plot in HoloViews?

喜夏-厌秋 提交于 2020-01-15 09:58:07
问题 I have the following code: import numpy as np import holoviews as hv from bokeh.models import FixedTicker hv.extension('bokeh') points = hv.Points(np.random.randint(-3, 4, (20, 3)), vdims=['interval']) points.opts( color='interval', size=10, colorbar=True, color_levels=7, colorbar_opts={ 'major_label_overrides': { -3: 'high', -2: 'medium', -1: 'low', 0: 'none', 1: 'low', 2: 'medium', 3: 'high' }, 'major_label_text_align': 'left', }, cmap='RdYlGn', ) Which produces something like: However, I

How do I get HoloViews to display in Google Colabs notebooks?

江枫思渺然 提交于 2020-01-05 03:47:27
问题 I can't get any HoloViews graphics to display in any Google Colabs notebook. For example even the simple Bokeh example right out fo the HoloViews introduction points = hv.Points(np.random.randn(500,2)) points.hist(num_bins=51, dimension=['x','y']) fails to show anything, without any error being reported, while the same code (and all example code from HoloViews) works fine in local Jupyter notebooks. If I download the Colabs notebook locally and open it, I see the following where I say nothing

How to change color in networkx graph plotted with holoviews/bokeh?

巧了我就是萌 提交于 2019-12-25 01:49:33
问题 How can I change the color of individual nodes in the following example? %pylab inline import pandas as pd import networkx as nx import holoviews as hv hv.extension('bokeh') G = nx.Graph() ndxs = [1,2,3,4] G.add_nodes_from(ndxs) G.add_weighted_edges_from([(1,2,0), (1,3,1), (1,4,-1), (2,4,1), (2,3,-1), (3,4,10)]) hv.extension('bokeh') %opts Graph [width=400 height=400] padding = dict(x=(-1.1, 1.1), y=(-1.1, 1.1)) hv.Graph.from_networkx(G, nx.layout.spring_layout).redim.range(**padding) 回答1:

Bokeh or HoloViews multiple depended dropdowns

大城市里の小女人 提交于 2019-12-24 21:17:08
问题 I have a data set with 3 of the columns having categorical values. I want to create 3 drop downs in Bokeh or HoloViews in which the first drop down selection determines the values of the list in the other 2 drop downs. Can anyone point me to any of the tutorials or blog or docs that show how to this. I don't seem to fine any.​ I appreciate your time. Thanks! 回答1: If you are working in a Jupyter notebook, you can use paramnb to do this, taking advantage of the way a notebook separates code

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 chart not going away, even after jupyter lab notebook is closed

夙愿已清 提交于 2019-12-24 11:53:55
问题 My problem is very similar to this question. I'm not able to remove a chart I originally rendered with holoviews, despite shutting everything down. I'm reduced to opening the ipyb in sublime to see if I can find the relevant json section and rip it out by hand . In fact, please reference that link to see the example screenshot, since I can't share anything which contains company data. However, unlike that question, I don't have any extensions installed: jupyter labextension list JupyterLab v0

How do kdims work for polygons in geoviews?

耗尽温柔 提交于 2019-12-24 11:34:18
问题 I'm trying to understand how the kdims work for Polygon plots in geoviews. There is a similar question here but it hasn't really been answered - GeoViews: add a slider to chloropleth with Polygon geometries In http://geo.holoviews.org/user_guide/Geometries.html the line gv.Polygons(world, vdims='pop_est') yields a world map with polygons shaded by population, and I think what it's somehow doing is getting lat/long as the kdims but I don't understand how this works. If I try to specify

How to control Holoviews y-tick format?

烈酒焚心 提交于 2019-12-24 10:55:25
问题 I am trying to gain control of the Holoviews Curve (though this should work for any other plotting element) and set the y-tick labels to be in scientific notations. In MatPlotLib I would do this with ticklabel_format(style='sci', axis='y', scilimits=(0,0)) . Currently I have this: But would like the Y axis numbers to be in scientific notations instead of the long decimal numbers currently shown on the Y axis. Is there anyway to do this and what is it? 回答1: HoloViews let's you supply a tick

Displaying Paths with Geoviews

[亡魂溺海] 提交于 2019-12-24 08:48:01
问题 I'm trying to use geoviews to display a path. I can get it to display ONLY the points properly: import numpy as np import geoviews as gv import cartopy.crs as ccrs import pandas as pd hv.extension('bokeh') coord_system = ccrs.UTM(17) userLine = [[ 501386.89237725, 3026047.23276743], [ 502233.40219658, 3030363.86891928], [ 497065.22714886, 3031309.6654351 ], [ 499260.08171301, 3027147.9437062 ], [ 494678.08475863, 3026891.08691589], [ 494971.32963864, 3025188.1383645 ], [ 496475.86909916,

How to set active tools in Holoviews

强颜欢笑 提交于 2019-12-23 03:41:54
问题 Sometimes my plots get drawn with the pan tool active and sometimes they draw with pan and wheel_zoom active. I'd like to force wheel_zoom to be active upon rendering. Is there a way to do this? 回答1: Since holoviews 1.11.0 was released the original answer has been outdated. HoloViews now has an explicit option to set the active tool(s), called active_tools which accepts a list of tool names or instances, e.g. to activate the wheel_zoom tool by default you would do this: hv.Curve([1, 2, 3])