Open
Description
Run on MDApp
, a Graph example gets shorn of labels and other peripheral decorations.
Run the following example with and without a command line argument:
$ python graphlayout.py [anything]
I can't tell where the wrinkle belongs, yet I hope there's something to be done about it.
graphlayout.py:
import sys
from math import sin
from kivy.lang import Builder
from kivy.properties import ObjectProperty
if len(sys.argv) > 1:
from kivy.app import App
else:
from kivymd.app import MDApp as App
from kivy.uix.widget import Widget
from kivy_garden.graph import Graph, MeshLinePlot
class SetGraph(Widget):
def update_graph(self):
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x, sin(x / 10.0)) for x in range(0, 101)]
App.get_running_app().root.ids.graph_test.add_plot(plot)
class GraphLayoutApp(App):
def build(self):
return Builder.load_file("graphlayout.kv")
def on_start(self):
"""On Start"""
ids = self.root.ids
ids.g_test.update_graph()
if __name__ == "__main__":
GraphLayoutApp().run()
graphlayout.kv:
#:import MeshLinePlot kivy_garden.graph.MeshLinePlot
BoxLayout:
orientation: "vertical"
SetGraph:
id: g_test
Graph:
id: graph_test
plot: MeshLinePlot
xlabel:'X'
ylabel:'Y'
x_ticks_minor:5
x_tics_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
pos: 0, root.height / 6
size: root.width * 2 / 4 , root.height * 18 / 24
Metadata
Assignees
Labels
No labels
Activity