Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:06
    jonmmease opened #4706
  • 16:03

    jonmmease on dash_autorange_fix

    Make Dash and HoloViews autoran… (compare)

  • 14:58
    jonmmease commented #4705
  • 14:57
    jonmmease synchronize #4705
  • 14:57

    jonmmease on plotly_rgb_padding

    Also disable for image and rast… (compare)

  • 14:53
    philippjfr commented #3548
  • 14:45
    jbednar commented #4705
  • 14:34
    Yura52 commented #3548
  • 14:33
    Yura52 commented #3548
  • 14:20
    jonmmease opened #4705
  • 14:14

    jonmmease on plotly_rgb_padding

    Disable plot padding for plotly… (compare)

  • 14:00
    jbednar commented #4567
  • 13:34
    jbednar synchronize #4567
  • 13:34

    jbednar on cnorm

    Set default colormap to match s… (compare)

  • 13:31
    jonmmease opened #4704
  • 13:29

    jonmmease on dash_responsive_options

    Add "width" and "height" respon… (compare)

  • 13:22
    jbednar synchronize #4567
  • 13:22

    jbednar on cnorm

    Cleaned up wording (compare)

  • 11:58
    iRave edited #4703
  • 10:54
    iRave opened #4703
Jacob Barhak
@Jacob-Barhak
unnamed.jpg
Jacob Barhak
@Jacob-Barhak
How do I force using matplotlib backend with holoviews rather than bokeh when I create holoviews plots that are later svaed by panel save. The following code generated bokeh figure even if I explicitly ask for matplotlib:
data = {}
data['Year'] =    [2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, ]
data['Cohorts'] = [  22,   34,   40,   47,   47,   91,   91,  123,  123, ]

holoviews.extension('matplotlib')
plot1 = holoviews.Scatter(data, kdims=['Year'], vdims=['Cohorts'], backend='matplotlib')
#
# I make a few more plots here - some are bokeh plots
# then I finish with
section3_2_1_right = panel.pane.HoloViews(plot1, width=400, height=170)
Am I using a proper syntax?
James A. Bednar
@jbednar
I don't think backend='matplotlib' does anything there; the backend is determined at the display or output stages, not during Element creation. Not sure why that's not an error, though.
And Panel is always based on Bokeh, so the full panel can only be Bokeh based. You should be able to set it up to render individual plots using Matplotib, though.
Jacob Barhak
@Jacob-Barhak
Thanks @jbednar , so I I want to show a maptplotlib plot and bokeh plot next to each other on different panels, how can I do this? I am trying to add this to the tutorial next week so people can see that Holoviews can handle multiple backends, yet if it is too complex, I will just use bokeh.
By the way, I plan to release the tutorial under CC0 - do you have any objections? I can use another open source license, yet I think CC are best for tutorials - since I put your name on the presentation, I rather you approve - I will put it on Gihub when it looks better - probably by tomorrow. Yet I want to know you are ok with the license.
James A. Bednar
@jbednar
No problem. I haven't tried that, but I'd guess it's something like pn.Row(hv.output(plot1, backend='bokeh'), hv.output(plot1, backend='bokeh'), where you probably have to pass some arguments to hv.output to specify you want a figure output rather than html, etc. @philippjfr would know...
Jacob Barhak
@Jacob-Barhak
Thanks @jbednar , problem solved - this actually works, the backend has to be specified at the panel level, and there is a warning - I just missed in among all the warnings the system shows - it tells me it does not recognize backend by Holoviews - This is good. If I move fast enough I will post the tutorial skeleton on Github under CC0 by tonight.
Jacob Barhak
@Jacob-Barhak
image.png
James A. Bednar
@jbednar
Cool!
Jacob Barhak
@Jacob-Barhak
Well @jbednar - not really - there are red boxes around the markdown text - no idea why - I am trying to figure it out now. not sure why they appear.
Jacob Barhak
@Jacob-Barhak
And @jbednar - this is odd, notice how markdown code section is shown once with red outline and once as colored keywords - this is at the markdown library level, yet it is very odd - I will investigate if this can be controlled.
James A. Bednar
@jbednar
Seems odd.
Jacob Barhak
@Jacob-Barhak
Yes,, Very odd, it happens every once in a while - not sure when - here is another example
image.png
I will go on and figure this out when everything is ready - it worked before so its a minor issue that can be taken care of.
Jacob Barhak
@Jacob-Barhak
Problem with code highlight is not really a problem - the markdown library supports different highlight for different languages. So to get python highlight one should use : ''''python
hoangthienan95
@hoangthienan95
Hi everyone, does hvplot support heatmap with datashading? Could not find an example in the docs and adding datashade=True to the examples in here causes an error. About to file github issue but just wanna double check
James A. Bednar
@jbednar
Datashader output is already a heatmap of sorts, so it depends what you mean.
Usually you'll add datashade=True on whatever your original data was, not on .heatmap.
So e.g. .hvplot.scatter(... datashade=True), etc.
Once it's already a heatmap there's not much left for Datashader to do, as basically what Datashader does is to make heatmaps!
hoangthienan95
@hoangthienan95
image.png
Ah, so if my data looks like this, and I want to visualize this giant heatmap
then I just do .heatmap(columns="columns", index="index") right?
I ask bc when zooming in it is slow, so I thought it was somehow not optimized yet
maybe I just need to connect to a more powerful dask backend and turn that matrix to a dask dataframe then call the heatmap function again?
James A. Bednar
@jbednar
You could plot that with Datashader by creating an image out of it and datashading that (not sure how in .hvplot, but in HoloViews it's hv.Image(...)), but that requires you to throw away your categorical axes and replace them with numerical ones. Datashader only knows about numerical axes. If there is some reasonable ordering, then maybe that makes sense. If there's no ordering, there's no point in such a viz, as Datashader would then be aggregating across adjacent columns and rows that have nothing in common.
Whether it's Dask or Pandas or Numpy doesn't matter; whether it's categorical data does matter. If you can map from categorical data into numeric data, then Datashader can handle it. If not, it has no idea what to do with your categorical x and y axes; it's built for continuous variables on x and y (though it does support categories on z, i.e. stacked up together).
Zooming in won't really help if the data has no structure; if it's truly categorical in x and y you just have to deal with the data in chunks somehow, because categorical data isn't meaningful without a label.
hoangthienan95
@hoangthienan95
But then will I be getting the dynamic recomputation as I zoom in to inspect finer-grained patterns?
James A. Bednar
@jbednar
There aren't any finer grained patterns unless the axes are sorted in some meaningful way.
It would just be meaninglessly grouping unrelated values.
Datashader can handle when the data has spatial structure (in whatever space you are plotting things in). Without spatial structure, zooming is not meaningful.
hoangthienan95
@hoangthienan95
ok so something like hierarchichally clustering the rows and columns and rearrange them would help, because I do expect patterns from that
James A. Bednar
@jbednar
Sure, at which point you can replace the category axis with some similarity metric value.
But then you'll want to reveal categories when you've zoomed in to individual data points, which I guess you can do with hover.
It would be great to add something to the examples where we show that whole process, i.e. starting with categorical axes, clustering the data to give spatial structure, then displaying the datashaded result with some way of indicating underlying categories (with colors plus hover, etc.) That would make a nice example, but it's a good bit of work, with lots of assumptions along the way. In no way would that get packaged up as .hvplot.heatmap(... , datashade=True). :-)
It's somewhat similar to https://examples.pyviz.org/iex_trading/IEX_stocks.html, where zooming in reveals individual stock trades, and zooming out reveals patterns; you'd need some similar approach, plus the clustering.
hoangthienan95
@hoangthienan95
I'll check that out thanks. "Visualizing interactive heatmap with hierarchical clustering with more than 1k cols and rows" seems a good weed out interview question. I have not found a way to do that easily so far
James A. Bednar
@jbednar
:-)
hoangthienan95
@hoangthienan95
does hvplot has a way that I can insert in a dendrogram?
James A. Bednar
@jbednar
I don't think so.
hoangthienan95
@hoangthienan95
because it would be helpful to see which ones are in the same group
James A. Bednar
@jbednar
Yep. That would be cool!
hoangthienan95
@hoangthienan95
I just tried, hvplot.heatmap alone doesn't even display the 3000x3000 heatmap. It works well with around 500x3000 tho!
thank you @jbednar for the rapid help :)
James A. Bednar
@jbednar
1K x 1K isn't so bad, actually, given current monitor resolutions, because at least then all the data will fit on screen. The problem is then just that the data means nothing without the labels. So If you do only want something where there's no actual aggregation (Datashader's specialty), i.e. no downsampling required, then I withdraw my objections about it being meaningless without clustering. Clustering would help a lot, but if every category bin at least gets one pixel, it's not ridiculous to simply datashade the array.