wxpython绘制折线图
environment:win10 + eclipse + pydev + python2.7.11 + wxpython3.0.2
code sample:
#!/usr/bin/env python
# -*- coding: UTF-8 -*- import wx
import wx.lib.plot as plot class MyFrame(wx.Frame):
def __init__(self):
self.frame1 = wx.Frame(None, title="test", id=-1, size=(500, 300))
self.panel1 = wx.Panel(self.frame1)
self.panel1.SetBackgroundColour("white") Button1 = wx.Button(self.panel1, -1, "Update", (200,220))
Button1.Bind(wx.EVT_BUTTON, self.redraw) plotter = plot.PlotCanvas(self.panel1)
plotter.SetInitialSize(size=(500, 200)) data= [[1, 10], [2, 5], [3,10], [4, 5]]
line= plot.PolyLine(data, colour='red', width=1) gc= plot.PlotGraphics([line], 'Test', 'x', 'y')
plotter.Draw(gc) self.frame1.Show(True) def redraw(self, event):
plotter = plot.PlotCanvas(self.panel1)
plotter.SetInitialSize(size=(500, 200)) data2= [[1, 20], [2, 15], [3,20], [4, -10]]
line= plot.PolyLine(data2, colour='red', width=1) gc= plot.PlotGraphics([line], 'Test', 'x', 'y')
plotter.Draw(gc) app = wx.PySimpleApp()
f = MyFrame()
app.MainLoop()
error 1:raise ImportError("NumPy not found.\n" + msg)
solution: run console with"cmd", and run 'pip install numpy'.
error 2:TypeError: Required argument 'type' (pos 2) not found
solution:that's A BUG with wx3.0.2!
patch the latest wx.lib.plot can totally solve that.
url:https://github.com/wxWidgets/wxPython/commit/30bc07d80ae1c81d70b4de2daac62ecd7996d703
now everything is fine!

转载注明出处:http://www.cnblogs.com/ityoung/
github: https://github.com/ityoung
wxpython绘制折线图的更多相关文章
- 用canvas绘制折线图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- php中用GD绘制折线图
php中用GD绘制折线图,代码如下: Class Chart{ private $image; // 定义图像 private $title; // 定义标题 private $ydata; // 定 ...
- UUChart的使用--iOS绘制折线图
UUChart是一个用于绘制图表的第三方,尤其适合去绘制折线图. 二.下载地址: https://github.com/ZhipingYang/UUChartView 三.使用 第一步.首先我们将下载 ...
- html5绘制折线图
html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...
- Android自己定义组件系列【9】——Canvas绘制折线图
有时候我们在项目中会遇到使用折线图等图形,Android的开源项目中为我们提供了非常多插件,可是非常多时候我们须要依据详细项目自己定义这些图表,这一篇文章我们一起来看看怎样在Android中使用Can ...
- JFreeChart绘制折线图实例
JFreeChart是JAVA平台上的一个开放的第三方图表绘制类库.只要下载JFreeChart的类库,导入项目即可使用.下面是一个绘制折线图的实例.各处注释都已经写的比较清晰了. package c ...
- 【带着canvas去流浪】(2)绘制折线图
目录 一. 任务说明 二. 重点提示 三. 示例代码 3.1 一般折线图 3.2 用贝塞尔曲线绘制平滑折线图 四. 大数据量场景 示例代码托管在:https://github.com/dashnowo ...
- python使用matplotlib绘制折线图教程
Matplotlib是一个Python工具箱,用于科学计算的数据可视化.借助它,Python可以绘制如Matlab和Octave多种多样的数据图形.下面这篇文章主要介绍了python使用matplot ...
- 用PNChart绘制折线图
写在前面 上一篇文章已经介绍过用PNChart绘制饼状图了,绘制折线图的步骤和饼状图的步骤是相似的,按照中的准备做好准备工作后就可以绘制折线图了. 开始使用 1.在view中声明一个PNLineCha ...
随机推荐
- <![CDATA[的web使用简单说明
html.javascript会涉及到三个解析器,html解析器.xml解析器.javascript解析器.那么好了,问题来了,以上代码经常混编在一起,各自有各自的规则,终究会有冲突的,如下就是冲突. ...
- 在xampp中配置dvwa
DVWA主要是用于学习Web的常见攻击,比如SQL注入.XSS等的一个渗透测试系统,下面我将结合XAMPP来说明它的安装过程. 一.环境 OS:Windows 10 XAMPP:5.6.24 DVWA ...
- Swift3 - String 字符串、Array 数组、Dictionary 字典的使用
Swift相关知识,本随笔为 字符串.数组.字典的简单使用,有理解.使用错误的地方望能指正. ///************************************************** ...
- Spring、hibernate以及struts2三大框架的整合
1.首先导入整合框架所需要的43个jar包: 2.配置xml文件: <?xml version="1.0" encoding="UTF-8"?> & ...
- Java 修饰符
Java语言提供了很多修饰符,主要分为以下两类: 访问修饰符 非访问修饰符 修饰符用来定义类.方法或者变量,通常放在语句的最前端.我们通过下面的例子来说明: public class classNam ...
- 安装wampserver时提示丢失MSVCR110.dll(在windows server上可用)
对于32位系统,安装Wampserver 后启动的时候提示系统错误:MSVCR110.dll丢失. 于是卸载原来的WAMPSERVER .安装vcredist_x86.exe,重新安装WAMPSERV ...
- 萌新笔记——git的问题(error: object file .git/objects/* is empty...)的解决方案及对git版本库文件的了解
由于操作不当,导致git版本库出了大问题,如下所示: error: object file .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e ...
- "高大上" 名词整理
大家在和朋友,同行交流时有没有经常遇到各种 "高大上" 的术语,很多词有没有把各位 “鸟哥” 们搞得一头雾水,现在我就把这些 "牛逼" 的东东都罗列一下, 大家 ...
- LZ77.py
import math from bitarray import bitarray class LZ77Compressor: """ A simplified impl ...
- [LeetCode] Arranging Coins 排列硬币
You have a total of n coins that you want to form in a staircase shape, where every k-th row must ha ...