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绘制折线图的更多相关文章

  1. 用canvas绘制折线图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. php中用GD绘制折线图

    php中用GD绘制折线图,代码如下: Class Chart{ private $image; // 定义图像 private $title; // 定义标题 private $ydata; // 定 ...

  3. UUChart的使用--iOS绘制折线图

    UUChart是一个用于绘制图表的第三方,尤其适合去绘制折线图. 二.下载地址: https://github.com/ZhipingYang/UUChartView 三.使用 第一步.首先我们将下载 ...

  4. html5绘制折线图

    html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...

  5. Android自己定义组件系列【9】——Canvas绘制折线图

    有时候我们在项目中会遇到使用折线图等图形,Android的开源项目中为我们提供了非常多插件,可是非常多时候我们须要依据详细项目自己定义这些图表,这一篇文章我们一起来看看怎样在Android中使用Can ...

  6. JFreeChart绘制折线图实例

    JFreeChart是JAVA平台上的一个开放的第三方图表绘制类库.只要下载JFreeChart的类库,导入项目即可使用.下面是一个绘制折线图的实例.各处注释都已经写的比较清晰了. package c ...

  7. 【带着canvas去流浪】(2)绘制折线图

    目录 一. 任务说明 二. 重点提示 三. 示例代码 3.1 一般折线图 3.2 用贝塞尔曲线绘制平滑折线图 四. 大数据量场景 示例代码托管在:https://github.com/dashnowo ...

  8. python使用matplotlib绘制折线图教程

    Matplotlib是一个Python工具箱,用于科学计算的数据可视化.借助它,Python可以绘制如Matlab和Octave多种多样的数据图形.下面这篇文章主要介绍了python使用matplot ...

  9. 用PNChart绘制折线图

    写在前面 上一篇文章已经介绍过用PNChart绘制饼状图了,绘制折线图的步骤和饼状图的步骤是相似的,按照中的准备做好准备工作后就可以绘制折线图了. 开始使用 1.在view中声明一个PNLineCha ...

随机推荐

  1. C#Excel文件加密实现,支持xlsx、docx、pptx(C#\Net\Asp.Net)

    从此刻开始,我已封闭!概不接客! 像风一样的男人,像风一样的性格,无拘无束,不拘一格.那么问题来了,当风遇到沙,不一定你是风儿,我是沙儿的缠缠绵绵,.也许是漫天黄沙,飞粒走石.如果我们期望擒住这漫天的 ...

  2. VisualStudio 调试Linux

    微软自从换了CEO之后,拥抱开源的步伐真实越来越快了,这部,现在VS可以跟踪Linux程序了 http://blogs.msdn.com/b/vcblog/archive/2015/11/18/ann ...

  3. 你必须知道的HTTP错误

    发送网络请求有时失败,分析一下响应行,在响应的响应行内,你会发现响应行由三部分组成,用空格来隔开,HTTP/1.1 404 NOT FOUND,第一个是响应的HTTP的版本,第二个和第三个是状态值. ...

  4. 【代码笔记】iOS-页面之间的跳转效果

    一,工程图. 二,代码. RootViewController.m -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { ...

  5. IOS 杂笔-15(知识小点 readonly)

    readonly是我们并不陌生的属性. 但是他也有值得我们注意的地. 属性如其名-只读-也就是说我们只能读取-不能进行写操作 当我们尝试进行写操作时会如下 但是这并不意味着我们不可以改变其内部的属性 ...

  6. iOS7之后设置NavigationBar的背景

    iOS7之后,请注意需要使用setBarTintColor ``` [self.navigationController.navigationBar setBarTintColor:[UIColor ...

  7. zend studio 快捷键

    复制当前行:ctrl+alt+↓ 删除当前行:Ctrl+d 行注释:Ctrl+/ 快注释(先选中要注释的代码):Ctrl+shift+/ 提示助手(方便函数等补全):alt+/ 代码格式化:Ctrl+ ...

  8. Oracle Connect by与递归with

    层次查询 select * from emp; select empno, ename, job, mgr, sal, deptno,level lv, sys_connect_by_path(ena ...

  9. MySQL Performance-Schema(二) 理论篇

    MySQL Performance-Schema中总共包含52个表,主要分为几类:Setup表,Instance表,Wait Event表,Stage Event表Statement Event表,C ...

  10. 用lumen构建API的相关流程

    概述 Lumen是一个基于Laravel的微框架,主要用于小型应用和微服务,专注于性能和速度的优化,该框架一个重要的应用就是构建 RESTAPI. 为什么用Lumen构建REST API Lumen访 ...