当前位置: 首页 > news >正文

网站不被收录的原因wordpress需要登录查看

网站不被收录的原因,wordpress需要登录查看,seo营销推广,岳阳网网有鱼我创建了Django视图“graph”#xff0c;目的是显示从matplotlib.pyplot模块。我编写了我的函数plot\u bubbles#xff08;返回amatplotlib.figure.figure对象#xff09;在脚本数据中_分析.py导入到视图.py脚本。在 Tkinter只能在主线程上运行#xff0c;我的网页在我第一…我创建了Django视图“graph”目的是显示从matplotlib.pyplot模块。我编写了我的函数plot\u bubbles返回amatplotlib.figure.figure对象在脚本数据中_分析.py导入到视图.py脚本。在 Tkinter只能在主线程上运行我的网页在我第一次请求时按预期工作但在刷新或再次请求时它不显示图像。我的理解是当视图再次被请求时Django在一个新线程上操作代码。在from django.http import HttpResponse from . import data_analysis import Queue import threading q Queue.Queue() def graph(request): parties [Conservative Party, Labour Party, Green Party, UKIP] def from_other_thread(graph_function): q.put(graph_function) def main_thread_execute(): callback q.get() fig callback return fig def grapher(arguments, area_variable): data_analysis.plt.close(all) from_other_thread(data_analysis.plot_bubbles(arguments, area_variable)) t threading.Thread(target grapher, args(parties, data_analysis.all_data[2015 Pay])) t.start() t.join() fig main_thread_execute() response HttpResponse(content_typeimage/png) fig.savefig(response, formatpng) return response 其目的是在主线程中运行函数以便Tkinter可以实际工作并创建图像我希望每次请求url时都创建图像因为我将允许用户通过表单选择他想要可视化的变量并将它们作为plot_bubbles函数的参数传递。在 我是django的初学者从未在代码中使用过多线程感谢您阅读本文。如有任何关于您的解决方案的解释我们将不胜感激。在 编辑 不一定需要穿线。问题源于我的数据分析脚本生成绘图的方式。尤其是方法调用的代码matplotlib.pyplot.subplothttp://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.subplots生成一个带有4个轴对象的图形 ^{pr2}$ 这似乎导致Tkinter无法在主循环上运行我还没有完全理解原因。这就是代码现在的样子#!/usr/bin/python # -*- coding: utf-8 -*- import pandas as pd import numpy as np from pandas import Series, DataFrame from pylab import figure, axes, plot, title, subplots import statsmodels.api as sm from sqlalchemy import create_engine from matplotlib.backends.backend_agg import FigureCanvasAgg import matplotlib # Load data from database into dataframe engine create_engine(postgresql://user_name:passwordlocalhost:5432/brexit) all_data pd.read_sql(SELECT * FROM records;, engine, index_colBorough) # Bubble Plot function creation colors np.random.rand(len(all_data.index)) area [] def plot_bubbles(arguments, area_variable, space0): ah iter(arguments) eh iter(arguments) ih iter(arguments) kh iter(arguments) th iter(arguments) zh iter(arguments) mh iter(arguments) fig figure(figsize(30, 25)) ax1 fig.add_subplot(2,2,1) ax2 fig.add_subplot(2,2,2) ax3 fig.add_subplot(2,2,3) ax4 fig.add_subplot(2,2,4) collection [ax1, ax2, ax3, ax4] for x in area_variable: #want the bubbles to have an average area of 40, add a factor to increase the variability in size factor ((x-area_variable.mean())**2/400) area.append(factor*x*(40/area_variable.mean())) for ax in collection: orient all_data[ah.next()] ax.set_ylabel(Leave %) ax.set_xlim([max(0, all_data[zh.next()].min()-all_data[mh.next()].min()/3), all_data[ih.next()].max()all_data[th.next()].max()/7]) results sm.OLS(all_data[Leave votes], sm.add_constant(orient)).fit() X_plot np.linspace(orient.min()-0.05, orient.max(), 100) ax.plot(X_plot, X_plot*results.params[1] results.params[0], ) for label, ori, leave in zip(all_data.index, orient, all_data[Leave votes]): ax.annotate(label, xy(ori, leave), xytext(ori, leave0.05), arrowprops{facecolor:black, connectionstyle:arc3,rad0.3, arrowstyle:simple}) ax.scatter(orient, all_data[Leave votes], sarea, ccolors, alpha0.6) ax.set_title(kh.next()) fig.subplots_adjust(hspacespace, wspacespace) return fig 随着图形和轴创建方式的改变问题得到了解决。如果有人能解释一下为什么会这样那就很有趣了。在
http://www.pierceye.com/news/408842/

相关文章:

  • 网站建设 提案 框架河南一般建一个网站需要多少钱
  • 福建省建设人才市场网站深圳营销型网站建设优化
  • 晋城购物网站开发设计宣传网站有哪些
  • 在哪人网站要以接it项目做企业为什么要分析环境
  • 达令的网站建设wordpress上传视频
  • 织梦免费网站模块下载地址南充楼盘网
  • 深圳极速网站建设服务器做网站 然后百度推广
  • 西充县住房和城乡建设局网站深圳建设局网站打不开
  • 深圳常平网站建设制作公司网站开发qq群
  • 校园网站建设的感受论文专业微信网站建设公司首选
  • 国外免费logo设计网站免费网课平台
  • 高端网站设计定制公司页面跳转自动更新
  • 项目建设资金来源网站网站开发技术可以做什么工作
  • 可做易企秀的网站网页建站网站
  • 南京网站建设价格大型网站开发协调
  • 园林景观设计公司点评的网站和论坛大型网站搜索怎么做的
  • 河南省建设教育培训中心网站广告机器设备的价格表
  • 郑州做网站哪家最好中国能源建设集团有限公司是什么级别
  • 品牌设计公司排行榜前十名seo外包服务公司
  • 潍坊网站建设 58wordpress 酒店预订
  • 个人网站主机选择电商公司官网
  • 名城苏州网站龙岗网站建设价位
  • 免费手机网站制作学做网站游戏教程
  • 什么企业做网站广州市公司网站建设
  • 无锡万度网站建设推广电影链接赚佣金
  • 电子商务网站建设与管理实训网页设计与网站建设基础心得体会
  • 托管的服务器如何做网站花店网站模板 html
  • 南宁保洁网站建设在线 代理 输入网址
  • 微站是什么意思快站app下载
  • 网站让女友做网站模特做网站好一点的软件