Im trying to limit my bar chart at 100 and i tried putting ylim(100) but it wont show and it wont work
import matplotlib
matplotlib.use('module://kivy.garden.matplotlib.backend_kivy')
from matplotlib.figure import Figure
from numpy import arange, sin, pi
from kivy.app import App
import numpy as np
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvas,\
NavigationToolbar2Kivy
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from matplotlib.transforms import Bbox
from kivy.uix.button import Button
from kivy.graphics import Color, Line, Rectangle
import matplotlib.pyplot as plt
N = 5
menMeans = (20, 35, 30, 35, 27)
menStd = (2, 3, 4, 1, 2)
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
plt.ylim(100)
fig, ax = plt.ylim(1000)
fig, ax = plt.subplots()
rects1 = ax.bar(ind, menMeans, width, color='b', yerr=menStd)
womenMeans = (25, 32, 34, 20, 25)
womenStd = (3, 5, 2, 3, 3)
rects2 = ax.bar(ind + width, womenMeans, width, color='r', yerr=womenStd)
# add some text for labels, title and axes ticks
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(ind + width)
ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5'))
ax.legend((rects1[0], rects2[0]), ('Men', 'Women'))
canvas = fig.canvas
class MatplotlibTest(App):
title = 'Matplotlib Test'
def build(self):
fl = BoxLayout(orientation="vertical")
nav1 = NavigationToolbar2Kivy(canvas)
fl.add_widget(nav1.actionbar)
fl.add_widget(canvas)
return fl
if __name__ == '__main__':
MatplotlibTest().run()
As you can see in the code i tried putting ylim but its not showing.