Bokeh hover info is behind some parts of the plot - python-3.x

I have a complex code, but it basically work like this:
I have multiple functions, that creat parts of the plot depending on inputs.
The main part of the plot is always shown, and depending on user inputs I add different subplots.
main_plot = gener_main_plot()
plot = add_some_box1(main_plot)
if some_user_iput:
plot = add_some_box2(plot)
plot = add_some_box3(plot)
The plot is generated, however the hover boxes are acting strange. Lets say the function add_some_box2 adds a hover to that part of the plot, but when I hover over that part, and if its big, it will be under the parts that were generated afterwards (add_some_box3).
Example:
How can I avoid this?
UPDATE: I am now using bokeh 1.0.1, however if I roll back to version 0.12.15, the problem is gone.

Related

Can I bold invididual elements in y_range of a bokeh chart?

I would like to bold some of the values in my y_range but not others.
I have tried using p.yaxis.major_label_text_font_style = 'bold'. This bolds everything. I have also tried setting it equal to a column in a ColumnDataSource, but major_label_text_font_style does not accept that as an input.
# Orient y axis labels
p.yaxis.major_label_text_font_size = '18pt'
p.yaxis[0].major_label_text_font_style = 'bold'
p.yaxis.major_label_text_font = "calibri"
I would like some of the text in my y_range to be bold, but not all of the text
As of Bokeh 1.1 there is no built-in way to accomplish this. [1] The main reason is that, in general, tick labels and locations can be chosen dynamically, as a result of panning and zooming. There is no guarantee a tick you want to treat differently will actually be labeled or on the screen at all. I.e. it's not useful to say "make the third tick bold" if you have no idea of knowing or controlling what the third tick will be.
However, it might be possible to do something different in the case of categorical ticks, which are normally always all displayed, and so known up-front. I'd encourage you to file a GitHub feature request issue to discuss it.
[1] One could potentially create a custom extension Axis subclass to do this, but that would be non-trvial work, as Axis is one of the most complicated BokehJS objects.

Italicize and color legend manually for different graphs using same labels and colors

I am trying to create multiple graphs that share the same legend.
I have found many ways to combine multiple graphs and it seems that ggarrange has the ability to create one shared legend for all that is supposed to be unique.
However I am having some problems when graphing since a few of the graphs do not have the same phyla (what defines the legend colors) present, but I would like them all to be the same colors throughout all of the graphs so the combined legend will have the correct colors.
For just one graph I would assign a color to the label manually like below
labs<-c("Arthropoda"="#FF66CC"
,"Cercozoa"="#FF6000")
and plot with the addition of scale_fill_manual(values=labs) and this seems to work
then I modified it so I could have portions of them italicized.
labsPhylum <-c('expression(paste(italic("Arthropoda")))'="#CC0000"
,'expression(paste(italic("Cercozoa")))'= "#FF6000"
,'expression (paste("unknown", ~italic("Eukaryota")))'= "#990000")`
However when I create a plot using ggplot and scale_color_manual() using the labsPhylum that I think should be italicized and colored I plot an empty graph with this warning so there is something vital I am not understanding here.
ggplot(data=sigtab_dil, aes(x=Species, y=log2FoldChange, color=Phylum))+
geom_point(size=2) +
scale_color_manual(values=labsPhylum)
Warning message:
Removed 9 rows containing missing values (geom_point).
Could someone please help me figure out where I am going wrong?
Thank you
Answered my own question
I realized I had to make separate vectors for breaks, labels, and values rather than combining them.
In short
colsPhylum <-c("Arthropoda"="#CC0000"
,"Cercozoa"= "#FF6000"
,"Chlorophyta"= "#CC9900"
labsPhylum <-c(expression(paste(italic("Arthropoda")))
,expression(paste(italic("Cercozoa")))
,expression(paste(italic("Chlorophyta ")))
breaksPhylum <-c("Arthropoda", "Cercozoa","Chlorophyta", "Choanozoa"
,"Ciliophora"
,"Cryptista"

"pixel dimension information" when plotting with image in gnuplot

Using gnuplot v5 patch 6 on windows 10 (wxt terminal)
I have a data file of 2D vectors arranged in six columns (x, y, v_x, v_y, v_mag, rho) that I'm trying to plot as a heatmap of v_mag against x and y. The plot generates fine, but it's always coming up with
"No dimension information for 80000 pixels total. Try 200 x 400"
But I have no idea where to specify this in the terminal.
I realise that I can use pm3d map for this, but this doesn't work without setting dgrid3d and that causes problems with plotting dots on top of the heatmap which I'm also doing. I also don't want to generate a matrix file just for the image plot since I need the vector data for analysis later.
In terms of an example, the plot will generate if I literally just write:
plot 'vectors.dat' using 1:2:5 with image, 'dots.dat' with dots
EDIT: added 'set pm3d' to example code
EDIT: example is now minimal code to produce desired plot
EDIT: example data file can be found here
Any help would be appreciated.
After updating my gnuplot to v5.2, this problem has disappeared.

gnuplot: Too many tooltips appearing at once on HTML canvas, causes browser freeze

I'm using gnuplot to create a scatter plot with potentially quite a few data points (greater than 1,000,000). I use the following command to plot the data and allow tooltips on mouse hover (the terminal is html canvas as these plots are meant to be displayed in a website):
plot "$resultsFile" using 2:(stringcolumn(8) eq "chr$chrom"?\$5:1/0):1 with labels hypertext point pt 7 ps var lc rgb "black"
The issue I'm having is: when I move my mouse over a dense cluster of datapoints, so many tooltips are displayed as the mouse moves that the browser freezes for a few seconds or even longer in an attempt to display them all. Does anyone know a way to stop this from happening? Perhaps by adding a delay before the tooltip is displayed on mouse over.

Why is duplicate text being rendered onto the Z buffer of a different texture when using D3DXFont::DrawText?

I've been stumbling over this for a while and was wondering if anyone has run into this problem before.
The application I'm working on is divided into multiple data plots and a single timeline at the bottom of the screen. Each plot (which is actually multiple textures layered on top of each other) as well as the timeline is rendered to a separate texture. The timeline texture is rendered first, followed by each of the plot textures from the top of the screen to the bottom. I am using DXUT and DirectX9 (March 2009).
After adding time text to the timeline texture, I noticed that the text was repeated in the title bar of every data plot. Here's a screencap of a portion of the display, it shows just a single plot, but the text repeats on every plot opened:
It seems like it is tied directly to the DrawText being called in the timeline's render function. I do use relative coordinates as the rect being passed to DrawText, but since I've already set the render target to the desired texture it should only affect the current texture. Not every texture rendered afterward.
Has anyone ever run into any problems similar to this using D3DXFont?
EDIT: After some more experimentation, it looks like it has something to do with the Z buffer. By adding D3DCLEAR_ZBUFFER to the clear on each texture surface, the duplicate text is gone. While the problem seems bypassed for now, I'm still curious as to why the Z buffer for a completely separate texture was being written during my DrawText call.
The Z Buffer state is persistent.
For example,
SetDepthStencilSurface(X)
SetRenderTarget(A)
Draw()
SetRenderTarget(B)
Draw()
Both Draw calls will use the same depth buffer.
The DrawText is not changing the depth buffer that you have set. It assumes you meant to do what you did.

Resources