最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

wxPython繪圖模塊wxPyPlot實現(xiàn)數(shù)據(jù)可視化

 更新時間:2019年11月19日 15:01:35   作者:網(wǎng)海水手  
這篇文章主要為大家詳細介紹了wxPython繪圖模塊wxPyPlot實現(xiàn)數(shù)據(jù)可視化,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了wxPython繪圖模塊wxPyPlot實現(xiàn)數(shù)據(jù)可視化的具體代碼,供大家參考,具體內(nèi)容如下

#-*- coding: utf-8 -*- 
 
################################################################################
## 使用wxPython的繪圖模塊wxPyPlot,需要數(shù)據(jù)可視化的時候,無需再借用其他的庫或模塊了
################################################################################
import numpy
import wx
import wx.lib.plot as wxPyPlot #導入繪圖模塊,并命名為wxPyPlot
 
#---------------------------------------------------------------------------
# 需要把數(shù)據(jù)封裝進入MyDataObject中
def MyDataObject():
 # 50 個點的sin函數(shù),用藍色圓點表示
 data1 = 2.*numpy.pi*numpy.arange(100)/100.
 data1.shape = (50, 2)
 data1[:,1] = numpy.sin(data1[:,0])
 markers = wxPyPlot.PolyMarker(data1, legend='Green Markers', colour='blue', marker='circle',size=1)
 
 # 50個點的cos函數(shù),用紅色表示
 data2 = 2.*numpy.pi*numpy.arange(100)/100.
 data2.shape = (50,2)
 data2[:,1] = numpy.cos(data2[:,0])
 lines = wxPyPlot.PolySpline(data2, legend= 'Red Line', colour='red')
 
 GraphTitle="Plot Data(Sin and Cos)"
 
 
 return wxPyPlot.PlotGraphics([markers, lines],GraphTitle, "X Axis", "Y Axis")
#-----------------------------------------------------------------------------
class TestFrame1(wx.Frame):
 def __init__(self, parent=None, id=wx.ID_ANY, title="Using wxPyPlot"):
  wx.Frame.__init__(self, parent, id, title,size=(600, 400))
  
  # 創(chuàng)建菜單欄
  self.mainmenu = wx.MenuBar()
 
  menu = wx.Menu()
  menu.Append(100, 'Draw1', 'Draw plots1')
  self.Bind(wx.EVT_MENU,self.OnPlotDraw1, id=100)
 
  self.mainmenu.Append(menu, '&Plot')
 
  self.SetMenuBar(self.mainmenu)
 
  # 創(chuàng)建狀態(tài)欄,顯示信息
  self.CreateStatusBar(2)
  
  self.pc = wxPyPlot.PlotCanvas(self) #此處導入繪圖面板
 
 def OnPlotDraw1(self, event): #繪圖函數(shù)
  self.pc.Draw(MyDataObject())
 
 
###########################################################################
## 測試wxPyPlot的代碼
###########################################################################
if __name__=='__main__':
  app = wx.App()
  tf=TestFrame1(None)
  tf.Show()
  app.MainLoop()

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

安图县| 遂溪县| 宜兰县| 琼结县| 伊金霍洛旗| 晋江市| 洛扎县| 梧州市| 龙门县| 会理县| 沁水县| 昌宁县| 义乌市| 松溪县| 合山市| 恩施市| 厦门市| 蕉岭县| 平阳县| 张家港市| 江门市| 将乐县| 理塘县| 沧州市| 博湖县| 灵川县| 墨竹工卡县| 渝北区| 南召县| 太湖县| 巴塘县| 临桂县| 庆安县| 柳林县| 富锦市| 芜湖县| 周宁县| 会东县| 松潘县| 乐清市| 织金县|