bokeh / bokeh

Interactive Data Visualization in the browser, from Python
https://bokeh.org
BSD 3-Clause "New" or "Revised" License
19.21k stars 4.18k forks source link

Add ability to change size of point in bokeh.charts.Scatter #3767

Closed brendancol closed 7 years ago

brendancol commented 8 years ago

Similiar to color, I'm looking for a hook into changing the size dimension on Scatter. One spelling that seems to fit in with current api would be something like:

s = Scatter(df, marker=marker(columns=['my_column_to_size_on'], size=[3,6,9,12,15]))
rothnic commented 8 years ago

@brendancol, @fpliger just spoke about this, and it would work work similar to color. I have a branch that supports binning of continuous columns to assign colors to.

The api currently works more like this:


Chart(df, ..., color='cyl')

Chart(df, ..., color=color('cyl'))

# new functionality for color attribute
Chart(df, ..., color=color('mpg', bin=True, palette=['green', 'red', 'blue']))

# new attribute
Chart(df, ..., size='cyl')

Chart(df, ..., size=size('cyl'))

# very specific sizes
Chart(df, ..., size=size('mpg', bin=True, sizes=[1, 5, 10]))

# provide some range of sizes
Chart(df, ..., size=size('mpg', bin=True, sizes=<call some range-producing function>)

Or something along those lines.

alimanfoo commented 7 years ago

+1, ability to vary size is the main reason I look to a scatter plot.

bryevdv commented 7 years ago

@alimanfoo it's now possible with bokeh.plotting to have properties be "computed columns" which means you can have the value of one column computed from some other column automatically on the browser. An example might be setting the size property of circles to be scaled by population. Similarly, color could be automatically mapped from some other field. This is the route I would suggest taking at this point. There is not currently a maintainer for bokeh.charts which means any improvements to it will be slow in coming for the time being. I apologize that I can't post a full example right now, I am on three hours sleep and under a deadline.

alimanfoo commented 7 years ago

Thanks very much for this, I figured out how to do it with plotting.circles.

On Thursday, September 22, 2016, Bryan Van de Ven notifications@github.com wrote:

@alimanfoo https://github.com/alimanfoo it's now possible with bokeh.plotting to have properties be "computed columns" which means you can have the value of one column computed from some other column automatically on the browser. An example might be setting the size property of circles to be scaled by population. Similarly, color could be automatically mapped from some other field. This is the route I would suggest taking at this point. There is not currently a maintainer for bokeh.charts which means any improvements to it will be slow in coming for the time being. I apologize that I can't post a full example right now, I am on three hours sleep and under a deadline.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bokeh/bokeh/issues/3767#issuecomment-248909590, or mute the thread https://github.com/notifications/unsubscribe-auth/AAq8QgAPDYufnYYWSZqfU0Q8rFE-AmyFks5qsohAgaJpZM4HNxyI .

Alistair Miles Head of Epidemiological Informatics Centre for Genomics and Global Health http://cggh.org The Wellcome Trust Centre for Human Genetics Roosevelt Drive Oxford OX3 7BN United Kingdom Email: alimanfoo@googlemail.com Web: http://purl.org/net/aliman Twitter: https://twitter.com/alimanfoo Tel: +44 (0)1865 287721

Maggie-M commented 7 years ago

moved to bkcharts repo