Holoviews - how to set legend click_policy for decimated points - bokeh

I'm trying to set click_policy to 'hide' in legend_opts for the object resulted from applying holoviews.operation.decimate on a set of hv.Points, but it doesn't seem to have the desired effect.
Now I'm using the muted_alpha option on the underlying hv.Points to hide the points, but this is suboptimal, since hovering over the invisible points still shows the tooltip, which is cluttering the output when showing multiple curves.
I've tried passing legend_opts={'click_policy': 'hide'} as opts for the Overlay container, as well as for both the underlying hv.Points and for the result of decimate (actually, I also tried passing it as an argument to decimate), but to no avail.
I even tried using a hook for the bokeh plot as suggested here to directly set plot_obj.state.legend.click_policy = 'hide', but that doesn't work either.
So, any idea on how to hide a set of decimated hv.Points completely (i.e., not showing the hover tooltips either)?
Note: I've followed the "Principles of datashading" section of holoviews' user guide on "Working with large data" and used decimate as indicated there.

Turns out that one has to set the options for hv.Overlay after calling collate on it.

Related

how to remove constant line from point line series?

I'm using constant lines to show a particular event for the graph and now I want to remove that particular event. I'm using constantline.dispose method but It's not working properly. lines are not getting removed after calling dispose function.
ConstantLine.dispose() should do the trick, and seems to work in the official interactive examples gallery (LCJS v.3.4.0).
If it is not working for you, please add some example code or pictures & description of desired and actual behaviours.

Make Octave set a figure to be the active window (come to the "front of the screen")

When Octave draws a plot, I would like it to set that to be the active window automatically, so that it becomes visible and I don't have to click back and forth between windows to see if the code and plot have finished. Is this possible? Since it would require reaching outside of Octave and controlling the OS, I'm not sure; it depends on whether or not that capability is part of Octave but I haven't found a reference for it yet.
I can always tell Octave to close the figure before opening a new one in the code, but that could prevent me from drawing multiple plots on the same axes, and it would require me to code that command in every time. It would be nice if there were a direct way just to bring the plot to be visible and take dominance over other windows.
EDIT: Somehow, although I noted that Octave would be required to control the OS to achieve this, I completely forgot to mention what that was... I'm running Windows 10 with the default window manager; I believe that would be the Desktop Window Manager.
When you plot something on a figure (whether you specify the figure you're plotting to within the plot command explicitly or simply let it plot into the currently active figure implicitly), this does not automatically raise the figure window to the forefront.
To do so, call the figure again using the figure function, along with the handle that you want to raise.
Alternatively, if you're sure that the figure you want to raise is the currently active one, you can simply use the shg command (which is effectively equivalent to figure(gcf))
E.g.
Fig1 = figure; % (or figure(1) if you want to be explicit)
Fig2 = figure; % (or figure(2) if you want to be explicit)
figure(Fig1); plot(1:10); % raise Fig1 to the forefront, and plot.
PS: Note that there was a bug affecting this behaviour until recently (coincidentally submitted by yours truly :p See https://savannah.gnu.org/bugs/?45943 ). This is fixed in the latest version of octave though (i.e. 5.1.0)

Get data from mouse events in plot.ly or ggvis within r (not shiny)

I want to use interactive plots in R to be able to select x intervals in plots, i have tried plot.ly and ggvis and it seems that the mouse click on the plot followed by horizontal drag, used for zooming is exactly what i want, but zoom would have to be disabled and the [x start, x end] values must be returned to R. Any ideas if this is possible, and if so, how?
I tried to make tooltip function available with static_output (without shiny).
You can check my fork (https://github.com/lujiacn/ggvis
), enable the tooltip by default, in Rstudio and output html widget.
The way is put tooltip content in one variable called "tooltip". If no "tooltip" variable, wills show the all values linked to the data.

How to disable transparency in knitr plots?

I have a LaTeX/knitr document that I need to convert to PDF/A, but I'm getting errors about transparency being used (which is not allowed in PDF/A). I traced it back to the background fills of the boxplots that I'm generating in R via knitr. Regardless of whether I use "pdf", "cairo_pdf" or "tikzDevice" as the output device, the same error results.
The Tikz output includes the following:
\definecolor{fillColor}{RGB}{255,255,255}
\path[use as bounding box,fill=fillColor,fill opacity=0.00] (0,0) rectangle (505.89,325.21);
Manually removing the fill opacity=0.00 part and rerunning only pdflatex gets rid of the message for a particular graph, so I'm pretty sure that's the cause. However, I'd prefer to make the change in the source file (R code), so I don't have to manually make this fix every time the source changes and the intermediate files are regenerated.
Does anyone know the magic option to feed bxp or par in R that would translate into an opacity of 1.0, or, better still, specify no fill at all? (The fill is completely unnecessary, given that it's a white background being placed on an empty part of a page.)
(BTW, I tried bg=NA in the bxp call, and par(bg=NA) before, and neither had any effect. For that matter, using "red" also had no effect, so that doesn't seem to be the right option.)
Apparently, the bg in the graphics parameters (par=) only applies to objects within the plot (like the boxes in a boxplot). The background for the whole plot is set in knitr's dev.args chunk option, e.g., globally:
opts_chunk$set(dev='tikz', dev.args=list(bg="white"))
or at the start of a particular chunk. It appears there's no way to drop the fill option entirely (there's a "TODO" item in the tikzDevice source code), but changing it to "white" has eliminated the PDF/A validation errors, with no visible effect on the document. Once my thesis is in, maybe I can submit a patch for this. :-)

iplot.setExtendedQuery: How to display custom mouse over information?

Concerning the superb iplots package in R:
By default, pressing CTRL and moving the mouse over a point in a scatter plot shows the x and y values of this point. How can I extend this to also show other attributes, which are not part of the plot, as shown here (see Mondrian screenshot) and as asked here, too?
In Mondrian, this works perfectly well by selecting any attributes within the data overview window and then pressing CTRL + SHIFT on a data point in a scatter plot for example. In iPlots, there is no way to select the attributes like this. I thought iplot.setExtendedQuery() is the key. However, there are no examples on how to use the query string.
Selecting a point plus printing the attributes using sth in the veins of mydata[iset.selected(), ] can't be the only way to go...

Categories

Resources