question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BOKEH_STRICT does not raise validation errors

See original GitHub issue

Hello,

I am plotting a rectangular grid where the axis labels are factors. If there are duplicated factors along any axis, as expected, an error should be raised. When I run my code I see:

ERROR:bokeh.core.validation.check:E-1019 (DUPLICATE_FACTORS): FactorRange must specify a unique list of categorical factors for an axis: duplicate factors found: 'a'

If I set BOKEH_STRICT=1 I don’t see any difference. I was expecting an exception being raised.

In the validation section of the documentation I found the check_integrity function which I hoped would raise the DUPLICATE_FACTORS error, but it does not. Is this a bug or expected behaviour?

How can I detect this issue before rendering to html? How can I catch the DUPLICATE_FACTORS validation error?

I’ve tested this on Bokeh 2.2.3 and 2.1.1

Below is my code:

import pandas as pd
import numpy as np

from bokeh.plotting import Figure
import bokeh.palettes as palettes
from bokeh.models import LinearColorMapper
from bokeh.transform import transform
from bokeh.resources import CDN
from bokeh.embed import file_html


index = ["a", "a"]
columns = ["b"]
N = len(index)
M = len(columns)
data = pd.DataFrame(np.random.rand(N * M).reshape(N, M), index=index, columns=columns)

ii, jj = np.meshgrid(data.columns, data.index, indexing="ij")
ii = ii.flatten()
jj = jj.flatten()
cc = [data.loc[j, i] for i, j in zip(ii, jj)]
plot_data = dict(x=ii, y=jj, colors=cc)

fig = Figure(
    x_axis_location="above",
    x_range=list(map(str, data.columns)),
    y_range=list(map(str, reversed(data.index))),
)
fig.rect(
    "x",
    "y",
    1,
    1,
    source=plot_data,
    color=transform("colors", LinearColorMapper(palette=palettes.magma(7))),
    line_color=None,
)

file_html(fig, CDN, "boom")

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Apr 7, 2021

@RandyRcw that’s great, let me know if there is anything I can do to help you get started, or questions I can answer

1reaction
pablo-estebancommented, Nov 30, 2020

I’ll do it. I just need to setup the dev environment…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Django form validation does not raise ValidationError
Django forms are not raising errors. instead, they give you a method that examines the data and determines whether it is valid or...
Read more >
Validation-Errors-Warnings - Research and Development
Perform this review step before you validate. To resolve errors, make sure that all Questionnaires are completed, all required Attachments have been uploaded, ......
Read more >
Handling Validation Errors - python-jsonschema
When an invalid instance is encountered, a ValidationError will be raised or returned, depending on which method or function is used.
Read more >
Form Validation Error NOT Raised When Form Is Submitted
I have a model form called "ContactForm" that has an email field. I created a custom forms.ValidationError in "clean_email" method.
Read more >
Active Record Validations - Ruby on Rails Guides
As you can see, our validation lets us know that our Person is not valid ... If these validations produce any errors, Rails...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found