holoviz param and panel: how to get a slider that allows a discrete list of irregularly-spaced float values? - holoviz

I am using holoviz param and panel to create a dashboard displaying gridded data on a map. I have two sliders to select grid coordinates x and y. Moving the sliders displays some data for the specified gridcell.
Right now I'm using two param.Integer objects to create the sliders with the bounds set to the dimensions of the xarray dataset containing the data. When a slider moves I grab a new slice from the dataset and update the dashboard.
I'd like my sliders to display the actual longitude and latitude coordinates, not the integer indices to the xarray dataset.
I can think of several ways to do this, but haven't gotten any of them to work.
update the displayed value on the slider to show the lat or lon. This keeps the internal slider value an integer but displays the float. I can't figure out what to update in the callback to change this value.
create sliders that display lat and lon as floats. The slider's allowed values would need to come from the list of lat and lon coordinates. The step between allowed values is not constant. So I'd need a float slider that allows, say, [74.0, 74.2, 74.5] and no other values.
Maybe (probably!) I'm just really dense but I can't quite see how to plug together the arguments to param.Number or param.Integer to make (1) or (2) happen.

Related

In Tableau Map plot multiple sites at same lat long

I have a data where at one latitude and longitude multiple shops are located.
For Example.
Latitude Longitude ShopId Type
6.24458 50.001756 101 Saloon
6.24458 50.001756 102 Groceory
6.24458 50.001756 103 Pharmacy
6.24458 50.001756 104 FishMarket
When on map I am plotting using above latitude & longitude I am getting single mark. And when I hover the mark I am getting single shop details but I want 4 marks and on each mark it should show respective shopid and Type.
I am new to Tableau and not able to figure out how to do it.
You are likely getting 4 marks displayed at the same location. So when you click on the mark you see, then you are only selecting the top mark. You can verify this by dragging over the mark to select all the marks within a selection rectangle. If you then, right click and view data, you should see all 4 marks.
Another thing that can help when you have overlapping marks, is to make the marks partially transparent and add a border around the marks. Both options are available by clicking on the Color button on the marks card to get to the advanced color settings.
If this is not the behavior you want, you have a couple of options. One easy approach is to add a little random noise to each latitude and longitude (called jitter). Adding a little jitter makes the marks visible, although the size of the jittering depends on your data and scale. Jittering is especially useful if all your points are geocoded to the same situation - say if every building with a Los Angeles address is treated as if it is located at city hall. In that case, the geocoding distorts the data to a degree that jittering is just fine.
The undocumented RANDOM() function is an easy way to add some jitter. Excel and Hyper Extracts support RANDOM() among other data source types. It returns a number between 0 and 1.
The other options involve treating your coordinates as continuous dimensions instead of measures, and then using some other visual attribute size, color etc to indicate the number of items at each location. It is often useful to combine nearby items with some sort of grid or hex bin function -- In this case, instead of adding random noise to each coordinate, you round or truncate it in someway to effectively snap points to a grid. The ROUND() and HEXBINX() HEXBINY() functions are useful here. When using this approach, be sure your packed coordinate fields are continuous dimensions and have the appropriate Latitude or Longitude geographic role.
Finally, take a look at the density mark type. It can make visual heat maps, either working with exact data points or grid packed points.

How to get the y value(s) of an NSBezierPath given any x value as input

I have an NSBezierPath which is shows a visual description of some data. As such, I not only need to see the NSBezierPath visually, I also would like to query it at any x value to determine the corresponding y value(s).
In short, I would like to use the NSBezierPath (or any BezierPath) in my view, and in my model. I want the view and the model to use the same formula, so that the visual representation of the model is accurate.
I recognize that in providing an x value, the number of corresponding y values could be zero, one, or many. Currently, I do not see any way to get individual points out of the NSBezier path, except for the control points and endpoints. I want to be able to query the Bezier Path for its value at ANY location, not just critical points.

Tableau 'map' type messing up sized visualization

I am making a map chart in Tableau where I have lat and long coordinates and I want the dots showing these locations to be bigger or smaller based on the number of mosquitos caught in the specific traps (marked by the lat and lon coordinates). This works perfectly as long as I use the 'automatic' chart type:
However if I switch to the 'map' type, the dots do not represent the sizes anymore. Notice that I did not change ANYTHING else but the chart type:
Could someone explain why this happens and how to 'fix' it?
If you want Tableau to display marks as circles, choose the circle mark type. No need to choose the map mark type unless you are trying to fill regions, say counties. In that case, you would usually put your measure on color instead of size.

Get Y value in line chart using cubic lines

I am using the Charts library in an iOS application. The required chart I am implementing, displays realtime values fed from a hardware peripheral. I already implemented adding new entries and scrolling to the latest value, so the chart appears to be updating constantly (sort of flowing to the left from the right side of the screen).
Now I need to draw a circle on the right side of the graph, but for that I would need to receive the Y value for the currently visible X. This is easy to get for the points in the DataSet, but I can't find a way to get Y value for the interpolated points between the DataSet values.
Here is what the graph looks like:

Stop Android Graph View from rounding the x-axis

I'm using graph view in my project and got it working just fine. However I don't like the x-axis values. The values I'm passing are 0,0.5,1,1.5,2,2.5...all the way to 23.5. I would like the graph to show every x-axis value on the grid and not rounded values of 0,3.4,6.9,10.3, 13.7 etc. Is there a way to force it to not round and use the x values provided?
the labels are have fix positions and shows the exact value at this point. It seems, that you want to have the another count of labels or other positions. In the current GraphView version you can set set count of labels. When you configure it in the correct way, you should see labels in 0.5-steps.
Have a look at GraphViewStyle#setNumHorizontalLabels