Shift datapoints

Hi There

I have some categorical data where the x-value is categorical and y-value is numerical. There are chances the y-values will be the same for multiple data-points and if the x-value are the same (likely) then I will have overlap. Is there a way to automatically space out values (along the x-axis) that have similar y-values??

I’m using Circles in Bokeh. I should also note.

For Reference. I’m looking to do spacing similar to this graph in Bokeh

Thank Everyone.

@Ravi_Bhanabhai If you must cross post on multiple forums, please help reduce the burden on maintainers by always providing the cross-links so that an answer in one place is an answer in all places. (And ideally, make sure yourself that answers are propagated across all places you have asked.)


There is nothing built in to Bokeh to do actual circle packing like the link, but it’s not clear that that’s what you actually want or need. If you just need a “jitter” transform to apply some random offsets to space things out, that is described here:

If you do need actual circle packing with no overlap for “large” circles (like the link), you would have to compute the positions for things manually.

For those interested. Using Offset worked. I had to remove using the source option.

Do you mean Categorical Offsets? If so, yes that was what I meant by positioning manually. But those can be used perfectly find with source (see the second “ridgeplot” example).