-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tap-plot #5
Comments
Does it work or do you have only issues with the styling? Does the tap plot work also with |
It works fine.
I think it would work for some fixed dimensions |
I tried the quadmesh, but it doesn't work. It works for an initial coordinate, but the streams function doesn't accept any further values. |
I see that heatmap cannot be overplot with contours. Thus I would stick with quadmesh unless we find another option how to plot the statistical significance. Therefore we need to find a way how the tap function could work with |
Here I enclose a inspiration how to handle it. XrViz's dashboard class is great inpiration ;) However, I used this example using panel to implement the tap functionality. graph_opts = dict(cmap = 'RdBu_r', symmetric=True, logy = True, colorbar = True, \
width = 400, ylim=(1000,0.1), active_tools=['wheel_zoom', 'pan'])
sel_data = ds_sel
graph = sel_data['coefs'].hvplot.quadmesh(x = 'x', y = 'y').opts(**graph_opts)
points = graph#hv.Points([])
taps = []
stream = hv.streams.Tap(source=points, x=np.nan, y=np.nan)
tap_stream = hv.streams.Tap(transient=True)
tap_stream.source = graph
taps_graph = hv.DynamicMap(
create_taps_graph,
streams=[tap_stream])
def create_taps_graph(x, y):
"""
from: https://github.com/intake/xrviz/blob/master/xrviz/dashboard.py#L369
"""
colors = ['#60fffc', '#6da252', '#ff60d4', '#ff9400', '#f4e322',
'#229cf4', '#af9862', '#629baf', '#7eed5a', '#e29ec8',
'#ff4300']
color_pool = cycle(colors)
color = next(iter(color_pool))
print(color)
if None not in [x, y]:
taps.append((x, y, color))
tapped_map = hv.Points(taps, vdims=['z'])
tapped_map.opts(color='z', marker='triangle', line_color='black',
size=8)
return tapped_map
@pn.depends(stream.param.x, stream.param.y)
def location(x, y):
"""
from: https://discourse.holoviz.org/t/example-of-using-holoviews-tapstream-with-panel/166/3
"""
first_column = pn.pane.Str(f'Click at {x:.2f}, {y:.2f}')
if np.nan not in [x,y]:
temp = sel_data.sel(x=x,y=y, method = 'nearest')
temp2 = temp['coefs'].where(temp['p_values'] < 0.05) # mark stat. sign. values
second_column = temp['coefs'].hvplot(width = 300) * temp2.hvplot.scatter(c='k')
else:
second_column = pn.Spacer(name='Series Graph')
return pn.Column(first_column, second_column) # hv.Points((x,y)))#
pn.Row(graph*taps_graph, location) |
I tried your example and the string-output works, but not on any plot-function. It seems that the stream function gets interrupted as the dataset is called. However, the ploting works, when no dataset is called (as you can see here in this meaningless function). It follows that not |
My attempt today was to use numpy arrays in connection with matlab.plot to get a result. It appears, that the plot is computed, but in't shown. |
It works in my case (see here). It looks like this |
Ok, that solves everything. I will go on and add it to the repository, add the p-values etc.. |
here you mark stat, sign. values, so plotting the p values seems needless. Shall I go on editing the tap plot, or isn't this nessesary and I focus on other plots? |
I think that you have enough references to produce both tap and ROI prototypes in the original scheme. Of course, the best option would be to have one prototype and let a user decide about the selection tool (ROI or tap). |
This code works for one variable but not more. I dont find the problem. Always when I delete one of the selected variables the tapplot doesn't work. |
What is actually progress here? Do you need any feedback from me? |
now, It works for any number of variables. My current problem is, that I need Slider for the Quadmesh and the Tapplot and can't combine them to one. |
I added widgets to control the parameters on the Tap-plot (here). I will go on with styling the plot and adding a table showing the clicked x , y values. Which improvment you think should I add? |
I like the progress. Nevertheless, I think that the issue with 2 sliders needs to be solved. I leave the styling up to you. It would be nice to plot several line plots together. Currently, we can see only tapped points on the left but only one line on the right. |
The issue with the 2 sliders was solved by changing the value directly in the function (here). |
Are there any issues blocking adding the following?
If yes, please open separate issues and close this one. You can still work on it (out of the contract) and/or it will be logged for the future reference. Ok? |
for some reason, it doesn't work as intended. I try some further aproaches.
done.
I currently work on it. |
I made a first attempt to run the tap-plot (tap). Shall I go on with styling, adding p-values, adding meanplots etc, or shall I try something different? It seems that all the build-in funktions of Holoviews are not for higher dimensional data. My idea would be, to use an input-function, which asks to choose a dimension and only then calculate the plot.
The text was updated successfully, but these errors were encountered: