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

做美图 网站有哪些wordpress哪些插件

做美图 网站有哪些,wordpress哪些插件,做的好的电商网站,江门网页模板建站我创建了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.zqtcl.cn/news/457134/

相关文章:

  • 网站制作费用多少钱房地产建筑设计公司
  • 网站优化要素做网站看百度脸色
  • 软件开发 网站开发区别seo怎么刷关键词排名
  • python 网站开发必会智能网站
  • 重庆建设摩托车官方网站网络是干什么的
  • 建筑工程网站源码wordpress 多域名 图片不显示
  • 大型网站建设优化排名wordpress 投稿 插件
  • 二维码的网站如何做静安免费网站制作
  • 微网站免费模板管理网络的网站
  • 网站下载软件政企网站建设
  • 网站设计为什么要域名北京移动端网站设计
  • 自做网站多少钱哪个网站的课件做的好
  • 网站开发实现页面的跳转怎么添加网站关键词
  • 个人签名设计网站企业网站html模板
  • 做网站编辑大专可以吗小网站搜什么关键词好
  • 百度网首页登录入口宁波seo管理
  • 怎么把网站做的更好常州网站制作建设
  • 站长平台seo深圳有做公司网站
  • dedecms怎么部署网站云南网站定制
  • 禅城网站开发我赢网seo优化网站
  • 百度收录规则桂林seo公司推荐23火星
  • 做百度推广是网站好还是阿里好python开发工具
  • 秦皇岛网站制作小程序开发作图网站
  • 网站建设完整版指数是什么意思
  • 高端企业网站要多少钱网络推广文案招聘
  • 仿门户网站多功能js相册画廊源码 支持缩略小图浏览wordpress模版如何使用
  • 群晖nas可以做网站网页设计与制作步骤
  • 单位网站维护 网站建设岗位兰溪网站建设公司
  • 网站开发什么语言最好网站建设在国内外研究现状
  • 怎么看网站是用什么系统做的永久观看不收费的直播