为什么mpld3条形图显示的是一个python文件的“版本”,而不是另一个?

2024-05-15 11:40:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我有两个版本的python文件(如果这是一个很好的描述方式的话),用于在网页上打印条形图(使用mpld3)。一个版本工作,而另一个(这将打印条形图,因为我想它)不工作。具体来说,index函数在每个python“版本”中返回的内容是不同的。为什么一个“返回值”导致条形图打印而另一个不打印?你知道吗

(简要解释一下我的程序应该做什么:SQLite3表中的数据被提取到python变量中,我想用它来创建一个使用mpld3的条形图。条形图的x轴上应该有癌症药物引起的不同副作用的名称,y轴上应该有每种副作用的发生百分比。)

作为一个初学者,请原谅我(可能是非常基本的)错误。非常感谢。你知道吗

下面是python代码,返回值在其中工作并打印条形图。现在这里返回的是包含生成的条形图的html:

import os
import matplotlib.pyplot as plt
import numpy as np
import mpld3

from cs50 import SQL
from flask import Flask, flash, jsonify, redirect, render_template, 
request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, 
InternalServerError
import sqlite3


app = Flask(__name__)

app.config["TEMPLATES_AUTO_RELOAD"] = True

app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

db = SQL("sqlite:///cancermeds.db")

@app.route("/", methods=["GET", "POST"])
def index():
    if request.method=="POST":

        selection = request.form.get("cancerlist")
        if selection == "breast cancer":
            rows = db.execute("SELECT * FROM 'breast cancer'")
            for row in rows:
                keys = list(row.keys())
                del keys[16:19]
                print(keys)
                values = list(row.values())
                del values[16:19]
                print(values)

                fig, ax = plt.subplots()
                fig = plt.figure(figsize=(7,6))
                ax = plt.bar(keys, values, width=0.5)
                plt.xlabel("Side Effects")
                plt.ylabel("Percentages of Occurence of Side 
    Effects")
            plt.title("Bar Chart showing Side Effects of Breast 
Cancer Medication(s) With Their Corrresponding Percentages Of 
Occurence")
            fig = ax[0].figure
            bar_chart = mpld3.fig_to_html(fig)

    return '''<DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    </head>
    <body>''' + bar_chart + '''</body>
    </html>'''

else:
    return render_template("index.html")


if __name__ == '__main__':
    app.run(debug=True)

下面的代码没有创建我想要创建的条形图,因为返回到函数的内容不起作用,我不明白为什么。代码如下:

import os
import matplotlib.pyplot as plt
import numpy as np
import mpld3

from cs50 import SQL
from flask import Flask, flash, jsonify, redirect, render_template, 
request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, 
InternalServerError
import sqlite3


app = Flask(__name__)

app.config["TEMPLATES_AUTO_RELOAD"] = True

app.config["SESSION_FILE_DIR"] = mkdtemp()
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

db = SQL("sqlite:///cancermeds.db")

@app.route("/", methods=["GET", "POST"])
def index():
    if request.method=="POST":

        selection = request.form.get("cancerlist")
        if selection == "breast cancer":
            rows = db.execute("SELECT * FROM 'breast cancer'")
            for row in rows:
                keys = list(row.keys())
                del keys[16:19]
                print(keys)
                values = list(row.values())
                del values[16:19]
                print(values)

                fig, ax = plt.subplots()
                fig = plt.figure(figsize=(7,6))
                ax = plt.bar(keys, values, width=0.5)
                plt.xlabel("Side Effects")
                plt.ylabel("Percentages of Occurence of Side 
 Effects")
            plt.title("Bar Chart showing Side Effects of Breast Cancer Medication(s) With Their Corrresponding Percentages Of Occurence")
            fig = ax[0].figure
            bar_chart = mpld3.fig_to_html(fig)

           return render_template("breastcancer.html", bar_chart = 
bar_chart)

    else:
        return render_template("index.html")


if __name__ == '__main__':
    app.run(debug=True)

这里是胸癌.html我引用的文件应该在后一个代码的index函数中返回:

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial- 
scale=1, shrink-to-fit=no">
        <title>Chemotherapy Comparison Website</title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min 
.css" rel="stylesheet">

    <link href="/static/favicon.ico" rel="icon">

    <link href="/static/styles.css" rel="stylesheet">

    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
    <h2>
        Chemotherapy Comparison Website
    </h2>
    <h3>
        Breast Cancer Page
    </h3>
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <div id="chart-display-col" col="col-md-6">
                {{bar_chart}}
            </div>
            <div id="info-display-col" col="col-md-6">

            </div>
        </div>
    </div>
</body>

在上面显示的html代码中,通过键入{{barchart}},我希望条形图能够显示在网页上。相反,我看到的似乎是许多行代码。我将在下面粘贴部分内容,很抱歉没有全部发布,因为行太多,超出了此问题允许的最大正文大小:

<style> </style> <div id="fig_el59641396267905660961816143295"> 
</div> <script> function mpld3_load_lib(url, callback){ var s = 
document.createElement('script'); s.src = url; s.async = true; 
s.onreadystatechange = s.onload = callback; s.onerror = function() 
{console.warn("failed to load library " + url);}; 
document.getElementsByTagName("head")[0].appendChild(s); } 
if(typeof(mpld3) !== "undefined" && mpld3._mpld3IsLoaded){ // 
already loaded: just create the figure !function(mpld3){ 
mpld3.draw_figure("fig_el59641396267905660961816143295", {"width": 
700.0, "height": 600.0, "axes": [{"bbox": [0.125, 
0.10999999999999999, 0.775, 0.77], "xlim": [-1.025, 16.025], 
"ylim": [0.0, 52.5], "xdomain": [-1.025, 16.025], "ydomain": [0.0, 
52.5], "xscale": "linear", "yscale": "linear", "axes": 
[{"position": "bottom", "nticks": 16, "tickvalues": null, 
"tickformat": null, "scale": "linear", "fontsize": 10.0, "grid": 
{"gridOn": false}, "visible": true}, {"position": "left", "nticks": 
7, "tickvalues": null, "tickformat": null, "scale": "linear", 
"fontsize": 10.0, "grid": {"gridOn": false}, "visible": true}], 
"axesbg": "#FFFFFF", "axesbgalpha": null, "zoomable": true, "id": 
"el5964139626790567160", "lines": [], "paths": [{"data": "data01", 
"xindex": 0, "yindex": 1, "coordinates": "data", "pathcodes": ["M", 
"L", "L", "L", "Z"], "id": "el5964139626787673648", "dasharray": 
"none", "alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data02", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787673144", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data03", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675104", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675888", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data05", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675944", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data06", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787726672", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data07", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787727456", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data08", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787728240", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729024", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729304", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data10", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787775712", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787776496", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data11", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787777280", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data12", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787778064", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data13", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787778344", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data14", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787837040", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}], "markers": [], "texts": [{"text": 
"Side Effects", "position": [0.5, -0.06337181337181337], 
"coordinates": "axes", "h_anchor": "middle", "v_baseline": 
"hanging", "rotation": -0.0, "fontsize": 10.0, "color": "#000000", 
"alpha": 1, "zorder": 3, "id": "el5964139626790622600"}, {"text": 
"Percentages of Occurence of Side Effects", "position": 
[-0.06065028161802356, 0.5], "coordinates": "axes", "h_anchor": 
"middle", "v_baseline": "auto", "rotation": -90.0, "fontsize": 
10.0, "color": "#000000", "alpha": 1, "zorder": 3, "id": 
"el5964139626790623608"}, {"text": "Bar Chart showing Side Effects 
of Breast Cancer Medication(s) With Their Corrresponding 
Percentages Of Occurence", "position": [0.5, 1.018037518037518], 
"coordinates": "axes", "h_anchor": "middle", "v_baseline": "auto", 
"rotation": -0.0, "fontsize": 12.0, "color": "#000000", "alpha": 1, 
"zorder": 3, "id": "el5964139626790701712"}], "collections": [], 
"images": [], "sharex": [], "sharey": []}], "data": {"data01": 
[[-0.25, 0.0], [0.25, 0.0], [0.25, 24.0], [-0.25, 24.0]], "data02": 
[[0.75, 0.0], [1.25, 0.0], [1.25, 8.0], [0.75, 8.0]], "data03": 
[[1.75, 0.0], [2.25, 0.0], [2.25, 40.0], [1.75, 40.0]], "data04": 
[[2.75, 0.0, 8.75], [3.25, 0.0, 9.25], [3.25, 19.0, 9.25], [2.75, 
19.0, 8.75]], "data05": [[3.75, 0.0], [4.25, 0.0], [4.25, 10.0], 
[3.75, 10.0]], "data06": [[4.75, 0.0], [5.25, 0.0], [5.25, 50.0], 
[4.75, 50.0]], "data07": [[5.75, 0.0], [6.25, 0.0], [6.25, 14.0], 
[5.75, 14.0]], "data08": [[6.75, 0.0], [7.25, 0.0], [7.25, 1.0], 
[6.75, 1.0]], "data09": [[7.75, 0.0, 10.75], [8.25, 0.0, 11.25], 
[8.25, 0.0, 11.25], [7.75, 0.0, 10.75]], "data10": [[9.75, 0.0], 
[10.25, 0.0], [10.25, 28.0], [9.75, 28.0]], "data11": [[11.75, 
0.0], [12.25, 0.0], [12.25, 31.0], [11.75, 31.0]], "data12": 
[[12.75, 0.0], [13.25, 0.0], [13.25, 32.0], [12.75, 32.0]], 
"data13": [[13.75, 0.0], [14.25, 0.0], [14.25, 0.3], [13.75, 0.3]], 
"data14": [[14.75, 0.0], [15.25, 0.0], [15.25, 1.8], [14.75, 
1.8]]}, "id": "el5964139626790566096", "plugins": [{"type": 
"reset"}, {"type": "zoom", "button": true, "enabled": false}, 
{"type": "boxzoom", "button": true, "enabled": false}]}); }(mpld3); 
}else if(typeof define === "function" && define.amd){ // require.js 
is available: use it to load d3/mpld3 require.config({paths: {d3: 
"https://mpld3.github.io/js/d3.v3.min"}}); require(["d3"], 
function(d3){ window.d3 = d3; 
mpld3_load_lib("https://mpld3.github.io/js/mpld3.v0.3.js", 
function(){ 
mpld3.draw_figure("fig_el59641396267905660961816143295", {"width": 
700.0, "height": 600.0, "axes": [{"bbox": [0.125, 
0.10999999999999999, 0.775, 0.77], "xlim": [-1.025, 16.025], 
"ylim": [0.0, 52.5], "xdomain": [-1.025, 16.025], "ydomain": [0.0, 
52.5], "xscale": "linear", "yscale": "linear", "axes": 
[{"position": "bottom", "nticks": 16, "tickvalues": null, 
"tickformat": null, "scale": "linear", "fontsize": 10.0, "grid": 
{"gridOn": false}, "visible": true}, {"position": "left", "nticks": 
7, "tickvalues": null, "tickformat": null, "scale": "linear", 
"fontsize": 10.0, "grid": {"gridOn": false}, "visible": true}], 
"axesbg": "#FFFFFF", "axesbgalpha": null, "zoomable": true, "id": 
"el5964139626790567160", "lines": [], "paths": [{"data": "data01", 
"xindex": 0, "yindex": 1, "coordinates": "data", "pathcodes": ["M", 
"L", "L", "L", "Z"], "id": "el5964139626787673648", "dasharray": 
"none", "alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data02", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787673144", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data03", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675104", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675888", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data05", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675944", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data06", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787726672", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data07", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787727456", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data08", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787728240", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729024", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729304", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data10", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787775712", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787776496", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data11", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787777280", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data12", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787778064", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data13", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787778344", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data14", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787837040", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}], "markers": [], "texts": [{"text": 
"Side Effects", "position": [0.5, -0.06337181337181337], 
"coordinates": "axes", "h_anchor": "middle", "v_baseline": 
"hanging", "rotation": -0.0, "fontsize": 10.0, "color": "#000000", 
"alpha": 1, "zorder": 3, "id": "el5964139626790622600"}, {"text": 
"Percentages of Occurence of Side Effects", "position": 
[-0.06065028161802356, 0.5], "coordinates": "axes", "h_anchor": 
"middle", "v_baseline": "auto", "rotation": -90.0, "fontsize": 
10.0, "color": "#000000", "alpha": 1, "zorder": 3, "id": 
"el5964139626790623608"}, {"text": "Bar Chart showing Side Effects 
of Breast Cancer Medication(s) With Their Corrresponding 
Percentages Of Occurence", "position": [0.5, 1.018037518037518], 
"coordinates": "axes", "h_anchor": "middle", "v_baseline": "auto", 
"rotation": -0.0, "fontsize": 12.0, "color": "#000000", "alpha": 1, 
"zorder": 3, "id": "el5964139626790701712"}], "collections": [], 
"images": [], "sharex": [], "sharey": []}], "data": {"data01": 
[[-0.25, 0.0], [0.25, 0.0], [0.25, 24.0], [-0.25, 24.0]], "data02": 
[[0.75, 0.0], [1.25, 0.0], [1.25, 8.0], [0.75, 8.0]], "data03": 
[[1.75, 0.0], [2.25, 0.0], [2.25, 40.0], [1.75, 40.0]], "data04": 
[[2.75, 0.0, 8.75], [3.25, 0.0, 9.25], [3.25, 19.0, 9.25], [2.75, 
19.0, 8.75]], "data05": [[3.75, 0.0], [4.25, 0.0], [4.25, 10.0], 
[3.75, 10.0]], "data06": [[4.75, 0.0], [5.25, 0.0], [5.25, 50.0], 
[4.75, 50.0]], "data07": [[5.75, 0.0], [6.25, 0.0], [6.25, 14.0], 
[5.75, 14.0]], "data08": [[6.75, 0.0], [7.25, 0.0], [7.25, 1.0], 
[6.75, 1.0]], "data09": [[7.75, 0.0, 10.75], [8.25, 0.0, 11.25], 
[8.25, 0.0, 11.25], [7.75, 0.0, 10.75]], "data10": [[9.75, 0.0], 
[10.25, 0.0], [10.25, 28.0], [9.75, 28.0]], "data11": [[11.75, 
0.0], [12.25, 0.0], [12.25, 31.0], [11.75, 31.0]], "data12": 
[[12.75, 0.0], [13.25, 0.0], [13.25, 32.0], [12.75, 32.0]], 
"data13": [[13.75, 0.0], [14.25, 0.0], [14.25, 0.3], [13.75, 0.3]], 
"data14": [[14.75, 0.0], [15.25, 0.0], [15.25, 1.8], [14.75, 
1.8]]}, "id": "el5964139626790566096", "plugins": [{"type": 
"reset"}, {"type": "zoom", "button": true, "enabled": false}, 
{"type": "boxzoom", "button": true, "enabled": false}]}); }); }); 
}else{ // require.js not available: dynamically load d3 & mpld3 
mpld3_load_lib("https://mpld3.github.io/js/d3.v3.min.js", 
function(){ 
mpld3_load_lib("https://mpld3.github.io/js/mpld3.v0.3.js", 
function(){ 
mpld3.draw_figure("fig_el59641396267905660961816143295", {"width": 
700.0, "height": 600.0, "axes": [{"bbox": [0.125, 
0.10999999999999999, 0.775, 0.77], "xlim": [-1.025, 16.025], 
"ylim": [0.0, 52.5], "xdomain": [-1.025, 16.025], "ydomain": [0.0, 
52.5], "xscale": "linear", "yscale": "linear", "axes": 
[{"position": "bottom", "nticks": 16, "tickvalues": null, 
"tickformat": null, "scale": "linear", "fontsize": 10.0, "grid": 
{"gridOn": false}, "visible": true}, {"position": "left", "nticks": 
7, "tickvalues": null, "tickformat": null, "scale": "linear", 
"fontsize": 10.0, "grid": {"gridOn": false}, "visible": true}], 
"axesbg": "#FFFFFF", "axesbgalpha": null, "zoomable": true, "id": 
"el5964139626790567160", "lines": [], "paths": [{"data": "data01", 
"xindex": 0, "yindex": 1, "coordinates": "data", "pathcodes": ["M", 
"L", "L", "L", "Z"], "id": "el5964139626787673648", "dasharray": 
"none", "alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data02", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787673144", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data03", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675104", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675888", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data05", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787675944", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data06", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787726672", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data07", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787727456", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data08", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787728240", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729024", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data04", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787729304", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data10", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787775712", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data09", "xindex": 2, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787776496", "dasharray": "none", 
"alpha": 1, "facecolor": "#1F77B4", "edgecolor": "none", 
"edgewidth": 1.0, "zorder": 1}, {"data": "data11", "xindex": 0, 
"yindex": 1, "coordinates": "data", "pathcodes": ["M", "L", "L", 
"L", "Z"], "id": "el5964139626787777280", "dasharray": "none", 
...........
1.8]]}, "id": "el5964139626790566096", "plugins": [{"type": 
"reset"}, {"type": "zoom", "button": true, "enabled": false}, 
{"type": "boxzoom", "button": true, "enabled": false}]}); }) }); } 
</script>

谢谢你的帮助。你知道吗


Tags: importalphanoneiddatacoordinatesmpld3zorder