2

The code is divided into two classes - table and representation.I am using bokeh for plotting.

When I click on a widget, it creates a class table and takes me to object representation.get_dia(),which should give me a line and a paragraph.

Code snippet from the table

def update_on_button_click():
            print(final_data)
            rep=representation(final_data)
            rep.get_dia()

get_dia() function -

def get_dia(self):
            curdoc().clear()
            from bokeh.models import Paragraph
            p2 = Paragraph(text='Under Construction',width=200, height=100)
            p1=figure()
            p1.line([1,2,3],[1,2,3])
            curdoc().add_root(row(p2,p1))

The function displays the paragraph in the browser but not the plot.

Is there any reason why this happens?

P.S The plot is visible, if I call it from the table function.

1 Answer 1

2
#from bokeh.plotting import figure --- adding this (even though I had added 
#this at the starting itself)
def get_dia(self):
        #curdoc().clear() --- And Removing this  solves the problem
        from bokeh.models import Paragraph 
        p2 = Paragraph(text='Under Construction',width=200, height=100)
        p1=figure()
        p1.line([1,2,3],[1,2,3])
        curdoc().add_root(row(p2,p1))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.