本文整理汇总了Python中kivy.garden.graph.Graph.add_plot方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.add_plot方法的具体用法?Python Graph.add_plot怎么用?Python Graph.add_plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.garden.graph.Graph
的用法示例。
在下文中一共展示了Graph.add_plot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def __init__(self, **kwargs):
super(BElGenLiveGraph, self).__init__(**kwargs)
graph = Graph(
xlabel="X",
ylabel="Y",
x_ticks_minor=5,
x_ticks_major=25,
y_ticks_major=1,
y_grid_label=True,
x_grid_label=True,
padding=5,
x_grid=True,
y_grid=True,
xmin=-0,
xmax=10,
ymin=-12,
ymax=12,
)
plot = SmoothLinePlot(color=[0.49, 0.98, 1, 1])
with open("adclog.txt") as fh:
coords = []
for line in fh:
line = line.strip("()\n") # Get rid of the newline and parentheses
line = line.split(", ") # Split into two parts
c = tuple(float(x) for x in line) # Make the tuple
coords.append(c)
plot.points = coords
graph.add_plot(plot)
self.add_widget(graph)
示例2: __init__
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def __init__(self, **kwargs):
super(case, self).__init__(**kwargs)
box = FloatLayout()
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=20, ymin=0, ymax=10)
plot = LinePlot()
# plot.points = [(x, sin(x / 10.)) for x in range(0, 101)]
# data = np.array([[0,0], [1,1],[2,2]])
data = collections.deque(maxlen = 20)
time = collections.deque(maxlen = 20)
d = (0,1,2,3,4,5,6,7,8,9)
t = (0,1,2,3,4,5,6,7,8,9)
data.append(d)
time.append(t)
toplot = np.vstack((time,data)).T
print toplot
plot.points = tuple(map(tuple, toplot))
graph.add_plot(plot)
box.add_widget(graph)
self.add_widget(box)
示例3: f_u_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def f_u_wid(self):
graph = Graph(xlabel='displacement', ylabel='force', x_ticks_minor=5,
x_ticks_major=1, y_ticks_major=100,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=0, xmax=self.max_displacement, ymin=-100, ymax=500)
self.f_u_line = MeshLinePlot(color=[1, 1, 1, 1])
self.f_u_line.points = [(0, 0)]
graph.add_plot(self.f_u_line)
return graph
示例4: eps_sig_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def eps_sig_wid(self):
graph = Graph(xlabel='slip', ylabel='bond', x_ticks_minor=5,
x_ticks_major=0.5, y_ticks_major=0.2,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0.0 * self.max_displacement, xmax=0.8 * self.max_displacement, ymin=-1, ymax=1)
self.eps_sig_line = MeshLinePlot(color=[1, 1, 1, 1])
self.eps_sig_line.points = [(0, 0)]
graph.add_plot(self.eps_sig_line)
return graph
示例5: cb_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def cb_wid(self):
graph = Graph(xlabel='z', ylabel='matrix stress', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=5,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-50, xmax=50, ymin=0, ymax=20)
self.cb_line = MeshLinePlot(color=[1, 0, 0, 1])
self.sctt.get_sig_m_cb()
self.cb_line.points = self.list_tuple(self.sctt.z, self.sctt.sig_m_cb)
graph.add_plot(self.cb_line)
return graph
示例6: shear_flow_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def shear_flow_wid(self):
graph = Graph(xlabel='length', ylabel='shear flow', background_color=[0, 0, 0, 1],
x_ticks_major=100., y_ticks_major=0.2,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=0.0, xmax=self.tl.ts.L_x, ymin=-1, ymax=1)
self.shear_flow_line = MeshLinePlot(color=[1, 1, 1, 1])
self.shear_flow_line.points = self.list_tuple(
self.x_coord, np.zeros_like(self.x_coord))
graph.add_plot(self.shear_flow_line)
return graph
示例7: build
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def build(self):
print 'create graph'
#self.canvas.add(Color(1., 1., 0))
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1)
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x, sin(x / 10.)) for x in range(0, 101)]
graph.add_plot(plot)
return graph
示例8: curve_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def curve_wid(self):
graph = Graph(xlabel='strain', ylabel='stress',
x_ticks_major=0.001, y_ticks_major=2,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=0, xmax=0.01,
ymin=0, ymax=self.sctt.sig_cu)
self.eps_sig_line = MeshLinePlot(color=[1, 1, 1, 1])
self.eps_sig_line.points = self.list_tuple(
self.sctt.eps_c_K, self.sctt.sig_c_K)
graph.add_plot(self.eps_sig_line)
return graph
示例9: cracking_wid
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def cracking_wid(self):
graph = Graph(xlabel='x', ylabel='matrix stress', x_ticks_minor=5,
x_ticks_major=100, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=0, xmax=1000, ymin=0, ymax=5)
self.sig_mu_line = MeshLinePlot(color=[1, 0, 0, 1])
self.sig_mu_line.points = self.list_tuple(
self.sctt.x, self.sctt.sig_mu_x)
self.sig_line = MeshLinePlot(color=[1, 1, 1, 1])
graph.add_plot(self.sig_mu_line)
graph.add_plot(self.sig_line)
return graph
示例10: Main
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
class Main(App):
def build(self):
root = BoxLayout()
self.graph = Graph(
y_grid_label=False, x_grid_label=False, padding=5,
xmin=0, xmax=100, ymin=0, ymax=30)
line = MeshLinePlot(points=[(0, 0), (100, 30)])
self.graph.add_plot(line)
root.add_widget(self.graph)
return root
示例11: EAGraph
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
class EAGraph(BoxLayout):
def __init__(self):
super(EAGraph, self).__init__()
self.graph = Graph(
xlabel="Generation",
ylabel="Y",
x_ticks_minor=5,
x_ticks_major=25,
y_ticks_minor=5,
y_ticks_major=40,
y_grid_label=True,
x_grid_label=True,
padding=5,
x_grid=True,
y_grid=True,
xmin=0,
xmax=120,
ymin=0,
ymax=200,
size=(800, 600)
)
red = [1, 0, 0, 1]
green = [0, 1, 0, 1]
blue = [0, 0, 1, 1]
self.cols = 2
self.orientation = 'vertical'
self.add_widget(self.graph)
legends = BoxLayout()
legends.orientation = 'horizontal'
legends.add_widget(Label(text='Standard deviation', color=red, size=(100, 200)))
legends.add_widget(Label(text='Average fitness', color=green, size=(100, 200)))
legends.add_widget(Label(text='Highest fitness', color=blue, size=(100, 200)))
self.add_widget(legends)
self.plot = []
self.plot.append(MeshLinePlot(color=red)) #X - Red
self.plot.append(MeshLinePlot(color=green)) #Y - Green
self.plot.append(MeshLinePlot(color=blue)) #Z - Blue
for plot in self.plot:
self.graph.add_plot(plot)
def add_datas(self, datas, generation):
for i in range(len(datas)):
self.plot[i].points.append((generation, datas[i]))
示例12: build
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def build(self):
root = FloatLayout(orientation='horizontal')
btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'right':1})#,'y':0})
btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})
root.add_widget(btnRight)
root.add_widget(btnLeft)
# scrollV = ScrollView(size_hint=(None,None),size=(800,400))
# scrollV.do_scroll_y=False
graph = Graph()
plot = LinePlot(mode='line_strip', color=[1,0,0,1])
plot.points = [(x[i],y[i]) for i in xrange(len(x))]
graph.add_plot(plot)
graph.x_ticks_major=1
graph.xmin=xmin
graph.xmax=xmax
graph.ymin=ymin
graph.ymax=ymax
graph.y_ticks_major=25
graph.y_grid_label=True
graph.x_grid_label=True
graph.xlabel='X axis'
graph.ylabel='Y axis'
graph.y_grid = True
graph.x_grid = True
def moveRight(obj):
global xmin
global xmax
xmin=xmin+.5
xmax=xmax+.5
graph.xmin=xmin
graph.xmax=xmax
#graph.remove_plot(plot)
#graph.add_plot(plot)
#graph._redraw_size(xmin,ymin,xmax,ymax)
btnRight.bind(on_release=moveRight)
def moveLeft(obj):
global xmin
global xmax
xmin=xmin-.5
xmax=xmax-.5
graph.xmin=xmin
graph.xmax=xmax
btnLeft.bind(on_release=moveLeft)
root.add_widget(graph)
# graph.bind(minimum_height=graph.setter('height'))
# scrollV.add_widget(graph)
return root
示例13: build
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def build(self):
self.availablePorts = listSerialPorts()
if len(self.availablePorts) == 0:
self.availablePorts.append("----")
tabbedPannel = TabbedPanel(do_default_tab=False)
# Connection Tab
self.connectionTab = TabbedPanelItem(text="Connection")
self.layout1 = BoxLayout(orientation='vertical', spacing=10, padding=(200, 200))
self.connectionTab.add_widget(self.layout1)
self.lblSerialSettings = Label(text="Connection settings")
self.layout1.add_widget(self.lblSerialSettings)
self.dlBaudrate = Spinner(values = ["57600", "115200", "230400", "460800", "921600"],
text = "115200")
self.layout1.add_widget(self.dlBaudrate)
self.dlPort = Spinner(values = self.availablePorts,
text = self.availablePorts[0])
self.layout1.add_widget(self.dlPort)
self.btnConnect = Switch()
self.btnConnect.bind(active = self.connect)
self.layout1.add_widget(self.btnConnect)
# Graph tab
self.graphTab = TabbedPanelItem(text = "Graph")
# self.layout2 = BoxLayout(orientation='vertical', spacing=10, padding=(200, 200))
# self.graphTab.add_widget(self.layout2)
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1)
plot = MeshLinePlot(color=[1, 1, 0, 1])
plot.points = [(x, sin(x / 10.)) for x in range(0, 101)]
graph.add_plot(plot)
self.graphTab.add_widget(graph)
tabbedPannel.add_widget(self.connectionTab)
tabbedPannel.add_widget(self.graphTab)
return tabbedPannel
示例14: build
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def build(self):
print 'create graph'
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=10, ymin=-12, ymax=12)
plot = MeshLinePlot(color=[1, 0, 0, 1])
with open("adclog.txt") as fh:
coords = []
for line in fh:
line = line.strip('()\n') # Get rid of the newline and parentheses
line = line.split(', ') # Split into two parts
c = tuple(float(x) for x in line) # Make the tuple
coords.append(c)
plot.points = coords
graph.add_plot(plot)
return graph
示例15: __init__
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import add_plot [as 别名]
def __init__(self, **kwargs):
super(BElGenLiveGraph, self).__init__(**kwargs)
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=10, ymin=-12,
ymax=12)
plot = SmoothLinePlot(color=[0.49, 0.98, 1, 1])
with open("adclog.txt") as fh:
coords = []
for line in fh:
line = line.strip('()\n')
line = line.split(', ')
c = tuple(float(x) for x in line)
coords.append(c)
plot.points = coords
graph.add_plot(plot)
self.add_widget(graph)