Hi:
I am trying to insert some subplots that are common in multiple html files, but I get the error:
Models must be owned by only a single document
I tried to use copy.deepcopy and serializing-deserializing json but no luck
Thanks
Hi:
I am trying to insert some subplots that are common in multiple html files, but I get the error:
Models must be owned by only a single document
I tried to use copy.deepcopy and serializing-deserializing json but no luck
Thanks
I solved it by removing the row with constant plots every time after save)) Below is the code block, I was getting rid of the last (third ) row:
doc = layout([
first_row,
second_row,
third_row
], sizing_mode="stretch_both", max_height=800)
output_file(html_path)
save(doc)
# remove the all score plots from the doc
doc.children.remove(doc.children[-1])
That’s one way. Another method would be to encapsulate the creation of the plots that need to go in multiple docs inside a function so that it’s easy to just create new ones.
You could use the somewhat obscure OutputDocumentFor
constext manager.
FWIW there is a private _clone
method on models:
I am not sure why this is private except perhaps that no one has ever asked about this before. You might open a GitHub issue to open a discussion about making this public.