title: How to add a bar graph in my main.py and in kv file?
body: <p>I want to add a bar graph that only shows on the progress screen. I am new to Kivy and Python. I am using matplotlib for the bar graph. I want to integrate the Bar.py code into my main.py code and progress.kv file. I am getting stuck on how to add it in my Progress.kv file.</p>
  <p>Bar.py</p>
  <h1>This is the code for the bar graph I want to show.</h1>
  <pre><code>import matplotlib.pyplot as plt 
  
  x = [2,4,6,8,10]
  y = [6,7,8,2,4]
  
  x2 = [1,3,5,7,9]
  y2 = [7,8,2,4,2]
  
  plt.bar(x,y, label='Bars1', color='blue')
  plt.bar(x2,y2, label='Bars2', color='c') 
  
  plt.xlabel('x')
  plt.ylabel('y')
  plt.title('Interesting Graph\nCheck It out')
  plt.legend()
  plt.show()
  </code></pre>
  <p>Main.py</p>
  <h1>I want to add the bar graph code into the 'Progress screen&quot; instead of passing.</h1>
  <pre><code>from kivy.app import App 
  #kivy.require(&quot;1.10.0&quot;)
  from kivy.uix.screenmanager import ScreenManager, Screen, 
  SlideTransition 
  from kivy.properties import ObjectProperty
  from kivy.properties import ListProperty
  from kivy.uix.image import Image
  from kivy.uix.label import Label 
  from kivy.graphics import *
  from kivy.core.window import Window
  from kivy.uix.widget import Widget
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.boxlayout import BoxLayout   
  from kivy.config import Config 
  from kivy.lang import Builder 
  import numpy as np 
  from math import sin 
  import matplotlib.pyplot as plt
  from kivy.garden.matplotlib.backend_kivyagg import 
  FigureCanvasKivyAgg
  import matplotlib
  from kivy.garden.matplotlib import FigureCanvasKivyAgg
  
  #Screens created in kv file. Declare all screens for app.    
  class Login(Screen):
      pass    
  class Connected(Screen):
      pass    
  class Patient(Screen):
      pass
  class Progress(Screen):
      pass  
  class Goals(Screen):
      pass 
  class Training(Screen):
      pass
  class Range(Screen):
      pass
  class Trial(Screen):
      pass
  class Symmetry(Screen):
      pass
  class Coordination(Screen):
      pass
  class Help(Screen):
      pass
  class Manager(ScreenManager):
      pass 
  class ScreenApp(App):
      def build(self):
          m = Manager(transition=SlideTransition()) 
          return m
  if __name__ == '__main__':
      #sets pixels to pixels on Raspberry Pi tablet
      Config.set('graphics', 'fullscreen', '0')
      Config.set('graphics', 'width', '800')
      Config.set('graphics', 'height', '480')
      ScreenApp().run()
  </code></pre>
  <p>Progress.kv</p>
  <h1>I have all the code for the progress screen in a kv file. I would like to add the design and details here but if not, then in the main.py.</h1>
  <pre><code>import matplotlib.pyplot as plt
  
  &lt;Progress&gt;:
  canvas.before:
      Color:
          rgb: 1, 1, 1 
      Rectangle:
          pos: self.pos
          size: self.size
  Button:
      text:'Patient Menu'
      font_size: 20
      bold: True
      size_hint: None, None
      size: 300, 50
      pos_hint: {'center_x': .5, 'center_y': .1 }   
      color: 1, 1, 1, 1               
      on_press: root.manager.current = 'Patient' 
  </code></pre>