This is a bit of a stupid problem but I'm using plotly for a 3d Scatter plot, essentially tweaking the Les Miserables plot in the docs, and I've managed to put links to the Wikipedia page for each node in the node labels.
Essentially, I'm replacing this line (in block 6 on that tutorials page): labels.append(node['name'])
with this line:
labels.append('{}'.format(node['name'], node['name']))
Works like a charm! Except that when I hover over the node, the label appears, but then when I go to click the link in the label, the label disappears (because I have oh-so-slightly hovered off of the node).
Like I said, kind of a stupid problem, but I really like the linking in the labels and this makes them almost unusable. Any ideas for how to deal with this (is there a way to set a lag for how quickly the labels disappear when you hover off? can the labels themselves trigger the hover?) would be greatly appreciated!
Here is a first draft example of what I'm working on:
https://plot.ly/~seth127/6
Thanks!
Related
I am creating a World Map, where you can hover over countries and click on their tooltips to link to a seperate website with more information on them. The problem is, I find the tooltips are too big, and get in the way. How do I resolve this issue?
I tried using the tooltip_font_size command to control it, but it just does not seem to make a difference. I get the same size of the Tooltips and the text inside them no matter what value I put in there. All the tooltip_border_radius command does is change how round the borders of my tooltips are. I am quite lost here, what do I do?
This is the code I have for now, I am excluding the added portion ( myworldmap.add) since it is unnecessary here.
import pygal
myworldmap = pygal.maps.world.World() #Defining our world map
myworldmap.title = 'Our friends origins'
myworldmap.tooltip_font_size = 15 #fontsize control
myworldmap.tooltip_border_radius = 5 #bordersize control
As I am aiming to plot the data into the plot, I encounter 2 problems.
(1) For the Bokeh function, while I am plotting 4 pictures in a row and adding the save as the SVG. Then the browser is shown as figure1. Moreover, as I comment out the code below, it work definitely right as I thought. It's weird.
p1.output_backend = "svg"
export_svgs(p1, filename="./number_like_comment/fig/{}.svg".format(action_str))
(2) For the second question, after I save those files, I realized that the "Label" I put in the plot also disappear. (as figure3).
Thanks so much for reading through. This question bother me quite a long time.
I guess that the data (on the x-axis) starts at 0, and on a logaxis for some reason the svg renderer doesn't like that and refuses to draw the entire line. The canvas renderer (used for the interactive plots) only refuses to draw the line-segment going from or to 0.
If you want to keep the logarithmic axis, you can either remove the 0 values or replace them by something which can be displayed in a logarithmic scale (e.g. 0.1) and then fixate the x-axis.
I'm trying to use Bokeh node/edge graph visualizations. I like most of what I've found thus far. However, I'd like to use a different hover mode for tooltips. From what I've found (https://docs.bokeh.org/en/latest/docs/user_guide/graph.html under "Interaction Policies"), I can hover either with "NodesAndLinkedEdges" (which hovers over nodes and highlights the node and its incident edges) or "EdgesAndLinkedNodes" (which hovers over edges and highlights the edge and nodes incident to it). Digging into the code itself (https://github.com/bokeh/bokeh/blob/master/bokeh/models/graphs.py), I found "NodesOnly" (which hovers and highlights only the node).
However, I would like to highlight the edge or node that I'm hovering over and add tooltips with attribute information over it. Unfortunately, none of the three cases I've found so far appear to support hovering over either nodes or edges. I tried looking in the code for if I could extend it to create a "NodeOrEdge" instance, but the code I found doesn't appear to do anything other than create the class name, add a comment, and then "pass". Clearly, something more is happening, but I can't see where (likely JavaScript?).
Does anyone know how to create a new version of GraphHitTestPolicy to Bokeh or get what I'd like out of it?
I just can't seem to grok plotting library documentation!
I have spent ages looking at the documentation for Bokeh and I can't figure out how to turn on the grid for this example: http://docs.bokeh.org/en/latest/docs/gallery/image.html
This is despite the fact that the thumbnail for this example actually does show the grid as seen here: http://docs.bokeh.org/en/latest/
I have tried looking at other gallery examples which do have grids visible but alot of them make no mention of grid.
Any ideas? Thanks!
I am afraid you have uncovered a deficiency in the current version (0.8.1) of Bokeh. The Image glyph was move to the underlay render level, which is the same as the grid. If you pan the plot, you will see the grid is actually on, the image is just on top of it. This might OK sometimes, but there is unfortunately not any way to change the render level back lower if that is what is desired. I've made an issue you can track:
https://github.com/bokeh/bokeh/issues/2040
This will be fixed in the 0.9 release.
I am working on a python 2.7+matplotlib+tkinter project where I need to plot up to 60 plots on 1 figure (I can show/hide them then by pressing corresponding legend title and do some other interactive stuff). What I want is to get an annotation box on mouse-over event with the label of current plot. I was thinking about text annotation, but I haven't found any ways to do it interactively.
If it is crucial for an answer - I am working with step and scatter figures. I am ready to provide any information needed, for now I just can't think of something necessary to post here (in terms of source code)