Comments (16)
HoloViews has the clim_percentile
plot option but that only applies to plot types that inherit from ColorbarPlot
, while RGBPlot
inherits from LegendPlot
. @ahuang11 I'd say we should first add this plot option to HoloViews? To eventually expose it in hvPlot, where I'd say robust
would be a good choice given that robust=True
would be already familiar to Xarray users.
from hvplot.
I was looking at https://github.com/holoviz/holoviews/blob/6aa6c9ddb7c9308531753efae41cbd0873c975a3/holoviews/plotting/bokeh/raster.py#L134 and I'm not sure there's a way to add clim_percentile to RGBPlot without updating Bokeh too.
I tried doing:
if self.clim_percentile:
low, high = 0, 1
style["color_mapper"] = LinearColorMapper(low=low, high=high)
AttributeError [Call holoviews.ipython.show_traceback() for details]
unexpected attribute 'color_mapper' to ImageRGBA, possible attributes are anchor, decorations, dh, dh_units, dilate, dw, dw_units, global_alpha, image, js_event_callbacks, js_property_callbacks, name, origin, subscribed_events, syncable, tags, x or y
I also tried doing:
if self.clim_percentile:
low, high = np.nanpercentile(img, (2, 98))
img[img < low] = low
img[img > high] = high
from hvplot.
Thoughts about having this in hvPlot?
holoviz/holoviews#6137
I don't have a strong preference, but I do want to have a way forward.
from hvplot.
I also don't have strong preference :)
from hvplot.
I also don't have strong preference 🙃
from hvplot.
I'm -1 on adding this anywhere. Taking percentiles of RGB values just does not make sense to me.
from hvplot.
If that's the case, how should users address this?
The initial goal was that I wanted to write a demo of how you can explore satellite imagery with hvplot easily, but then I encountered the issue that robust/clim_percentile was not exposed.
If robust/clim_percentile isn't implemented, its a tad tedious for the user to have to manually implement it for satellite imagery vs typing robust=True
.
Would you prefer it be an operation? E.g. Clip
?
from hvplot.
Will have to look at it.
from hvplot.
Yeah, looking at this dataset the values are not R G B values they are raw reflectance values for different spectra from a satellite. Visualizing them using an RGB element without first processing these values is simply incorrect. So the only thing I can imagine doing is providing some operation in geoviews.
from hvplot.
from hvplot.
Based on my reading of that the transformation is quite simple, you divide the red green blue values 2**8 and then cast to uint8.
from hvplot.
Alternatively you can also apply histogram equalization.
from hvplot.
Hmm, the division thing doesn't work.
from datashader.transfer_functions import eq_hist
hv.RGB(eq_hist(da.data)[0].transpose([1, 2, 0])).opts(width=600)
from hvplot.
hv.RGB((da / (2**2)).clip(0, 255).astype(np.uint8).data.transpose([1, 2, 0])).opts(width=600)
from hvplot.
Okay, I've come around I'd be okay with a two-pronged approach, we implement the robust semantics in hvPlot and then HoloViews appropriately clips the data.
from hvplot.
Philipp found the actual _rescale_imshow_rgb
robust usage in xarray here
from hvplot.
Related Issues (20)
- `datashade=True` doesn't work with `cuDF`
- ValueError when trying to display a netCDF file with the explorer
- Explorer: support exploring the variables of an xarray Dataset
- hvdataset package
- Odd behaviour in order of hvplot bars given number of columns. HOT 2
- Cannot overlay hvplot labels on inverted axes.
- Bad error message for missing kwarg in labels
- Bar Chart x axis labels not formatted HOT 3
- hvplot.image ignores data_aspect when responsive is True HOT 3
- option to remove invisible output from importing hvplot.pandas/xarray HOT 2
- scatter_matrix formatting considered harmful HOT 9
- Explorer doesn't infer the right x/y/groupby values for gridded data HOT 3
- Support reactive expressions in arguments and options HOT 6
- Support xyzservices tiles HOT 1
- Alpha not supported with plotly backend HOT 2
- No longer internally call `.reset_index()`
- Allow to pass options to tiles
- xarray Dataset subplot variables HOT 2
- Stacking plots with a datetime Index and plotly not showing data HOT 1
- [question] reason for not including some plots for the `polars.DataFrame.hvplot.{...}`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hvplot.