For questions, use https://discourse.holoviz.org/ instead! This chat is for informal discussions and debugging sessions with developers of the HoloViz.org tools (HoloViews, Datashader, Panel, hvPlot, GeoViews, Param, etc.), but user questions should go to the HoloViz Discourse site so that others won't have to ask them again.
philippjfr on custom_html_model
Fixed flake (compare)
panel serve
from command line. But not with python
and then .show()
or pn.serve()
in the python file. Is that correctly understood?
from flask import Flask, render_template
from werkzeug.wrappers import Request,Response
app=Flask(_name_)
@app.route('/plot/')
def plot():
from shapely.geometry import Point,Polygon
import pandas as pd
.......
.......
......
......
......
dd=df_div.opts(width=70, height=70)
dd1=df_div1.opts(width=600, height=90)
finalplot=pn.Column(pn.Row(dd, dd1), tiles*rasterize(hmap1).options(**opts)*hmap2*logo1.opts(hooks=[absolute_position], apply_ranges=False)).servable()
#print("--- %s seconds ---" % (time.time() - strtt))
#finalplot
script1, div1 = components(finalplot)
cdn_js=CDN.js_files[0]
#cdn_css=CDN.css_files[0]
return render_template("plot.html",
script1=script1,
div1=div1,
#cdn_css=cdn_css,
cdn_js=cdn_js )
@app.route('/')
def home():
return render_template("home.html")
@app.route('/about/')
def about():
return render_template("about.html")
if _name=="main_":
from werkzeug.serving import run_simple
#app.run(debug=True,port=)
run_simple('localhost',9000,app)
I am getting error
File "/home/XXXX/anaconda3/envs/plot2/lib/python3.7/site-packages/bokeh/embed/standalone.py", line 190, in components
models = _check_models_or_docs(models)
File "/home/XXXX/anaconda3/envs/plot2/lib/python3.7/site-packages/bokeh/embed/standalone.py", line 398, in _check_models_or_docs
'Input must be a Model, a Document, a Sequence of Models and Document, or a dictionary from string to Model and Document'
ValueError: Input must be a Model, a Document, a Sequence of Models and Document, or a dictionary from string to Model and Document
127.0.0.1 - - [23/May/2020 17:38:05] "GET /plot/ HTTP/1.1" 500 -
sorry for font size , by mistake it became bigger in font size.
File "/home/XXXX/anaconda3/envs/plot2/lib/python3.7/site-packages/bokeh/embed/standalone.py", line 190, in components
models = _check_models_or_docs(models)
File "/home/XXXX/anaconda3/envs/plot2/lib/python3.7/site-packages/bokeh/embed/standalone.py", line 398, in _check_models_or_docs
'Input must be a Model, a Document, a Sequence of Models and Document, or a dictionary from string to Model and Document'
ValueError: Input must be a Model, a Document, a Sequence of Models and Document, or a dictionary from string to Model and Document
127.0.0.1 - - [23/May/2020 17:38:05] "GET /plot/ HTTP/1.1" 500 -
Hi all, is there a way to use panel to change one part of clim
without using a RangeSlider? for instance, this works:
img = np.random.normal(size=(100,100))
hv_img = hv.Image(img)
slider = pn.widgets.RangeSlider(start=-5, end=5, value=(-1, 1), name='contrast')
hv_img = hv_img.apply.opts(clim=slider.param.value)
pn.Row(slider, hv_img)
but I can't get something like this to work:
img = np.random.normal(size=(100,100))
hv_img = hv.Image(img)
slider = pn.widgets.FloatSlider(start=0, end=5, value=1, name='contrast')
hv_img = hv_img.apply.opts(clim=(-1, slider.param.value))
pn.Row(slider, hv_img)
ValueError: clim: tuple element is not numeric: <param.Number object at 0x7f425a624bb0>.
Hi All,
I will very thankful to you and appreciate your help.
script1, div1 = components(finalplot.get_root())
Here get_root() is use to get the parent document but do i need to use curdoc() to get the current plot in flask as my plot is dynamic with dropdown option .
# not working
script1,div1=components(finalplot.curdoc())
which function i shoud call to get current document , so that when i change bokeh lot in embedded flask app then it should reflect in webpage also.
Thanks for quick reply @philippjfr
but its not working ,
can i do curdoc() by making standalone HTML files
from bokeh.io import curdoc
doc=curdoc()
# finalplot=finalplot.get_root(doc)
#
return Markup(file_html(finalplot.get_root(doc),CDN,"myplot"))
if __name__=='__main__':
app.run(debug=True)
it giving static plot , no zoom function , nothing.
2- by using component method no error is coming same time no plot is showing in webpage ,
i am using
from bokeh.resources import CDN
so there is no mismatch of bokeh cdn version but still no plot showing.
from bokeh.io import curdoc
doc = curdoc()
script, div = components(finalplot.get_root(doc))
cdn_js = CDN.js_files[1]
cdn_css=CDN.css_files
return render_template("plot.html",
script=script,
div=div,
cdn_css=cdn_css,
cdn_js=cdn_js)
#
plot.html
{%extends "layout.html"%}
{%block content%}
<link rel="stylesheet" href={{cdn_css | safe}} type="text/css" />
<script type="text/javascript" src={{cdn_js | safe}}></script>
<div class="about">
<h1>My about page</h1>
<p>This is a test website again</p>
</div>
{{script1 | safe}}
{{div1 | safe}}
{%endblock%}
My about page is showing , no error while plotting but plot is not showing in web page :(
sorry for lengthy .
I will really grateful if u guide me on this .
Thank you.