Skip to content

cannot zoom pan in the graph #2

@chau0806

Description

@chau0806

I followed the example that you shared in Github:
https://github.com/jeysonmc/kivy_matplotlib

I added the widget(home, zoom, pan) but I cannot zoom or do anything. Could you please support to check my code.

`import matplotlib as mpl
from kivy.app import App
import numpy as np
from kivy.lang import Builder
from kivy_matplotlib import MatplotFigure, MatplotNavToolbar
from kivy.uix.gridlayout import GridLayout

class testApp(App):
title = "Test Matplotlib"

def build(self): 
    "remove old graph"
    Graph_layout = GridLayout(cols=1, spacing=1, size_hint_y=1,size_hint_x=1, pos_hint= {'right': 1, 'top': 1})
    
    "config data to display in matplot"
    fig = mpl.figure.Figure()
    fig.gca().plot([1,2,3,4,5,6,3,2,1,4,5,9]) 
    fig.gca().grid(True)
    
    "display graph here"
    Configure = MatplotFigure(size_hint=(1,0.8),id='Graph')
    Configure.figure = fig
    
    "display widget here"
    figure_wgt = MatplotNavToolbar(size_hint=(1,0.2))
    figure_wgt.figure_widget=Configure
    
    "add wiget to layout"
    Graph_layout.add_widget(Configure)
    Graph_layout.add_widget(figure_wgt)
    return Graph_layout

testApp().run()`

Thank` you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions