mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
parent
d7b8b03267
commit
76eab3f9ce
@ -29,7 +29,7 @@ def outbreak(plot_type, r, month, countries, social_distancing):
|
||||
|
||||
if plot_type == "Matplotlib":
|
||||
fig = plt.figure()
|
||||
plt.plot(df['day'], df[countries])
|
||||
plt.plot(df['day'], df[countries].to_numpy())
|
||||
plt.title("Outbreak in " + month)
|
||||
plt.ylabel("Cases")
|
||||
plt.xlabel("Days since Day 0")
|
||||
|
@ -1130,7 +1130,7 @@ class Image(Component):
|
||||
"""
|
||||
if "plot" in kwargs:
|
||||
warnings.warn(
|
||||
"The 'plot' parameter has been deprecated. Set parameter 'type' to 'plot' instead.",
|
||||
"The 'plot' parameter has been deprecated. Use the new Plot() component instead",
|
||||
DeprecationWarning,
|
||||
)
|
||||
self.type = "plot"
|
||||
|
@ -22,9 +22,9 @@
|
||||
const bokehPromises = Array(6).fill(0).map((_, i) => createPromise(i))
|
||||
|
||||
const initializeBokeh = (index) => {
|
||||
if (value["type"] == "bokeh") {
|
||||
if (value && value["type"] == "bokeh") {
|
||||
resolves[index]()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createPromise(index) {
|
||||
@ -50,17 +50,18 @@
|
||||
let plotDiv = document.getElementById("plotlyDiv");
|
||||
Plotly.newPlot(plotDiv, plotObj["data"], plotObj["layout"]);
|
||||
} else if (value && value["type"] == "bokeh") {
|
||||
document.getElementById("bokehDiv").innerHTML = "";
|
||||
let plotObj = JSON.parse(value["plot"]);
|
||||
window.Bokeh.embed.embed_item(plotObj, "bokehDiv");
|
||||
window.Bokeh.embed.embed_item(plotObj, "bokehDiv");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if value && value["type"] == "plotly"}
|
||||
<div id="plotlyDiv"/>
|
||||
{:else if value}
|
||||
<div id="bokehDiv"/>
|
||||
{:else if value && value["type"] == "bokeh"}
|
||||
<div id="bokehDiv"/>
|
||||
{:else if value && value["type"] == "matplotlib"}
|
||||
<div
|
||||
class="output-image w-full h-80 flex justify-center items-center dark:bg-gray-600 relative"
|
||||
{theme}
|
||||
|
Loading…
x
Reference in New Issue
Block a user