Precision Error in stacked bar charts?

I’ve was looking at the stacked bar chart example from the tutorials (http://bokeh.pydata.org/tutorial/solutions/gallery/olympics.html). In the data set ITA, UKR, AUS etc. have won 0 gold medals. However, in the stacked plot a very thin gold line can be observed for these countries. Could this be due to some precision error? I am noticing similar issue when creating plots with other data sets as well.

Thanks,

Salil

Salil,

Currently BokehJS does not do any explicit checking for zero width or height or radius, which I imagine results in the single pixel artifacts you are seeing. Could you submit an issue for this on the GitHub tracker? Also if you are at all interested in submitting a Pull Request to fix this let me know, it should actually be a very simple fix, and I'd be happy to point you in the right direction.

Thanks,

Bryan

···

On Jun 2, 2014, at 6:38 PM, [email protected] wrote:

I've was looking at the stacked bar chart example from the tutorials (http://bokeh.pydata.org/tutorial/solutions/gallery/olympics.html). In the data set ITA, UKR, AUS etc. have won 0 gold medals. However, in the stacked plot a very thin gold line can be observed for these countries. Could this be due to some precision error? I am noticing similar issue when creating plots with other data sets as well.

Hi Brian,

I’ve posted this issue on Github. Could you point me to the right direction so that I can try to fix the issue?

Thanks,

Salil

···

On Monday, June 2, 2014 4:49:43 PM UTC-7, Bryan Van de ven wrote:

On Jun 2, 2014, at 6:38 PM, [email protected] wrote:

I’ve was looking at the stacked bar chart example from the tutorials (http://bokeh.pydata.org/tutorial/solutions/gallery/olympics.html). In the data set ITA, UKR, AUS etc. have won 0 gold medals. However, in the stacked plot a very thin gold line can be observed for these countries. Could this be due to some precision error? I am noticing similar issue when creating plots with other data sets as well.

Salil,

Currently BokehJS does not do any explicit checking for zero width or height or radius, which I imagine results in the single pixel artifacts you are seeing. Could you submit an issue for this on the GitHub tracker? Also if you are at all interested in submitting a Pull Request to fix this let me know, it should actually be a very simple fix, and I’d be happy to point you in the right direction.

Thanks,

Bryan

Hi Salil,

Thanks for posting the issue!

So this is a problem at the BokehJS issue, so to work on it the first step is just to make sure you can get everything building. Here are the instructions:

  http://bokeh.pydata.org/docs/dev_guide.html#installation-for-developers

If this is more than you want to dive into, that's fine one of us can take a look into the issue. But if you do get up and running in dev mode, then this is the file you want to look at:

  https://github.com/ContinuumIO/bokeh/blob/master/bokehjs/src/coffee/renderer/glyph/rect.coffee

There are some lines where it is checking for (and skipping) NaN values:

   if isNaN(sx[i] + sy[i] + sw[i] + sh[i] + @angle[i])
            continue

It think you would basically want to add another test that checks if the screen width or height is zero:

  if sw[i] == 0 or sh[i] == 0
            continue

Note there are two loops where you'd want to do this. And it might be nice to add similar checks to other glyphs like quad, or the markers, etc. Let me know what you think!

Thanks,

Bryan

···

On Jun 3, 2014, at 9:59 AM, [email protected] wrote:

Hi Brian,

I've posted this issue on Github. Could you point me to the right direction so that I can try to fix the issue?

Thanks,
Salil

On Monday, June 2, 2014 4:49:43 PM UTC-7, Bryan Van de ven wrote:

On Jun 2, 2014, at 6:38 PM, [email protected] wrote:

> I've was looking at the stacked bar chart example from the tutorials (http://bokeh.pydata.org/tutorial/solutions/gallery/olympics.html). In the data set ITA, UKR, AUS etc. have won 0 gold medals. However, in the stacked plot a very thin gold line can be observed for these countries. Could this be due to some precision error? I am noticing similar issue when creating plots with other data sets as well.

Salil,

Currently BokehJS does not do any explicit checking for zero width or height or radius, which I imagine results in the single pixel artifacts you are seeing. Could you submit an issue for this on the GitHub tracker? Also if you are at all interested in submitting a Pull Request to fix this let me know, it should actually be a very simple fix, and I'd be happy to point you in the right direction.

Thanks,

Bryan

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0b46199-3010-4aee-8b82-f41b5189367d%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

I do not have any experience working with Coffeescript and it would be a steep learning curve at this point to fix this bug. I appreciate your prompt response and hope someone will be able to fix it.

Thanks,

Salil

···

On Tuesday, June 3, 2014 8:12:08 AM UTC-7, Bryan Van de ven wrote:

Hi Salil,

Thanks for posting the issue!

So this is a problem at the BokehJS issue, so to work on it the first step is just to make sure you can get everything building. Here are the instructions:

    [http://bokeh.pydata.org/docs/dev_guide.html#installation-for-developers](http://bokeh.pydata.org/docs/dev_guide.html#installation-for-developers)

If this is more than you want to dive into, that’s fine one of us can take a look into the issue. But if you do get up and running in dev mode, then this is the file you want to look at:

    [https://github.com/ContinuumIO/bokeh/blob/master/bokehjs/src/coffee/renderer/glyph/rect.coffee](https://github.com/ContinuumIO/bokeh/blob/master/bokehjs/src/coffee/renderer/glyph/rect.coffee)

There are some lines where it is checking for (and skipping) NaN values:

     if isNaN(sx[i] + sy[i] + sw[i] + sh[i] + @angle[i])

        continue

It think you would basically want to add another test that checks if the screen width or height is zero:

    if sw[i] == 0 or sh[i] == 0

        continue

Note there are two loops where you’d want to do this. And it might be nice to add similar checks to other glyphs like quad, or the markers, etc. Let me know what you think!

Thanks,

Bryan

On Jun 3, 2014, at 9:59 AM, [email protected] wrote:

Hi Brian,

I’ve posted this issue on Github. Could you point me to the right direction so that I can try to fix the issue?

Thanks,

Salil

On Monday, June 2, 2014 4:49:43 PM UTC-7, Bryan Van de ven wrote:

On Jun 2, 2014, at 6:38 PM, [email protected] wrote:

I’ve was looking at the stacked bar chart example from the tutorials (http://bokeh.pydata.org/tutorial/solutions/gallery/olympics.html). In the data set ITA, UKR, AUS etc. have won 0 gold medals. However, in the stacked plot a very thin gold line can be observed for these countries. Could this be due to some precision error? I am noticing similar issue when creating plots with other data sets as well.

Salil,

Currently BokehJS does not do any explicit checking for zero width or height or radius, which I imagine results in the single pixel artifacts you are seeing. Could you submit an issue for this on the GitHub tracker? Also if you are at all interested in submitting a Pull Request to fix this let me know, it should actually be a very simple fix, and I’d be happy to point you in the right direction.

Thanks,

Bryan


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0b46199-3010-4aee-8b82-f41b5189367d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.