keplergl / kepler.gl

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
http://kepler.gl
MIT License
10.44k stars 1.75k forks source link

Manual color scale #1108

Open bskrt opened 4 years ago

bskrt commented 4 years ago

I would like to manually set the color of specific points from timeseries data.

I'm working with a large timeseries dataset with a basic point layer. The issue I have, is that when I set a color range based on a certain value, the color is set based on the entire dataset. So on day 1, all my values are light blue , and on the final day, every single value on the map is bright red because of the large difference in values. What I would actually want, is set those color values based on the actual filtered dataset. So coloring of the data would be based on 1 day of data instead of 60.

I see 2 options for this:

  1. Make color assignments based on the filtered data, not the entire dataset.
  2. Make it possible to pass an actual color value through the dataset. e.g. I have a column with a specific hex value (or just an index that would get remapped) which could be called fill_color and/or stroke_color (like the properties for geojson fillColor/strokeColor). And those colors would actually be the ones used in the layer visualisation.

I hope this makes some sense.

Thanks!

heshan0131 commented 4 years ago

@bskrt I understand completely your usecase. To me, option 2 makes more sense. Color scale is designed to use the entire dataset when it comes to time. It makes sense for time animation where the goal of the animation is to display value change over time.

However, when it comes to filter data based on time, the persist in color scale doesn't make much sense.

We have work in progress for the manual input of color scale already, that should be a good start

bskrt commented 4 years ago

@heshan0131 I hacked together a working version of option 2. In short, I'm just checking the data field names for a certain value (e.g. fillColor) and if it exists, it grabs that value as the fill color. Only annoyance is that if that column exists all other color functionalities obviously don't work but that's good enough for now. If anyone is interested I'll put it up somewhere.

the persist in color scale doesn't make much sense.

I guess that mostly depends on what you want to communicate in your visualisation. e.g. the data I'm currently working with is covid-19 cases, with a timeseries filter that filters day by day. So in this case, I'm using point size to show the case increments, so it's nice to see how the number of cases evolve over time. Regarding to color scale though, I'm using that to visualise the gravity of cases in different towns on a daily basis. So in this case, having the color mapping based on the filtered data makes more sense. Anyway, very case dependent.

A negative to option 2 is that you have to manually implement a lot of the functionalities that exist in kepler e.g. transform the data and implement scaling, ... not too time consuming, but just feels awkward.

Regarding option 1: I was wondering if there would be a way to actually call the method that implements the color scaling every time the filter updates? Just a thought.

heshan0131 commented 4 years ago

https://github.com/keplergl/kepler.gl/issues/399

KarthicKamalesh commented 1 year ago

@heshan0131

image

I am having count dataset range from 0 to 350. I'm using the fill color from Light pale blue to dark greenish blue.

image

Now my question is if the count is zero I want to remove the color from the base map. For 0 no color should be applied. Is that possible?