Download - Tutorial de MatplotLib
![Page 1: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/1.jpg)
1
Universidad Nacional de Colombia
Material de apoyo e laborado como apoyo a la materia
Métodos Numéricos
Diego Camilo Peña Ramírez (docente)
Twitter: @nervencid
TUTORIAL DE MATPLOTLIB
![Page 2: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/2.jpg)
2
CONTENIDO
● INTRODUCCION● MATPLOTLIB● INTRODUCCIÓN A PYPLOT● CREACIÓN DE MULTIPLES GRAFICAS (Subplot)● EDITANDO PROPIEDADES DE LAS GRAFICAS● MANEJO DE EVENTOS● MANEJO DE EVENTOS: Picking● MANEJO DE EVENTOS: Dragg● MANEJO DE EVENTOS: Hover ('mouse enter and
leave')● ANIMACIONES
![Page 3: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/3.jpg)
3
CONTENIDO
● PLOT 3D● CREACIÓN DE INTERFACES DE USUARIO (UI)● CREACIÓN DE INTERFACES DE USUARIO (UI):
Widgets● CREACIÓN DE INTERFACES DE USUARIO (UI):
Tkinter● Otras Interfaces de usuario (UI)● BIBLIOGRAFIA● SOBRE EL AUTOR Y EL CONTENIDO
![Page 4: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/4.jpg)
4
INTRODUCCIÓN
Como hemos podido darnos cuenta Python es una herramienta muy completa y autónoma; ya que nos permite hacer varias actividades sin depender de librerías externas o software de terceros. Sin embargo para aplicaciones más especializadas como lo son por ejemplo: análisis matemáticos, hacer gráficas de funciones o resolver ecuaciones, debemos acudir a librerías externas de terceros.
A continuación haremos una breve introducción a estas librerías que al igual que Python son de código abierto y nos dan prestación que no podemos lograr en otros lenguajes programación.
![Page 5: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/5.jpg)
5
Matplotlib es una librería de código abierto creada por el fallecido John Hunter(1968-2012), la cual posee un conjunto de herramientas para poder hacer gráficas en 2D y 3D, como alternativa a MATLAB en cuanto a creación de gráficos, recientemente se le a añadido la posibilidad de interaccionar con librerías como qt, Gtk, entre otras para poder hacer interfaces de usuario personalizadas [1].
MATPLOTLIB
![Page 6: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/6.jpg)
6
MATPLOTLIB esta compuesta de tres elementos fundamentales [2]:
PYLAB: Es un conjunto de funciones que permiten crear gráficas (plot's ) similares a los de MATLAB.
MATPLOTLIB API: Es una interfaz que contiene clases que crean y gestionan imágenes, textos, figuras y plot's.
BACKEND: Nos permite extender MATPLOTLIB a otras funcionalidades 'extra', como por ejemplo exportar a archivos 'PNG, PDF, SVG, etc...' o crear interfaces de usuarios con librerías especializadas como 'wxpython' o 'pygtk'
MATPLOTLIB
![Page 7: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/7.jpg)
7
INTRUCCIÓN A PYPLOTPYPLOT es un conjunto de comandos que permiten trabajar de manera similar a MATLAB, cada funcion de 'pyplot', genera algún tipo de cambio en la figura como por ejemplo: decorar la figura, agregar texto, crear graficas secundarias, etc...[2]
Para el siguiente ejercicio cree un nuevo archivo '.py' bien sea utilizando el editor integrado en Python o el entorno de desarrollo de su preferencia.
![Page 8: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/8.jpg)
8
INTRUCCIÓN A PYPLOT
![Page 9: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/9.jpg)
9
Al ejecutar el programa (F5) deberíamos obtener el siguiente resultado:
INTRUCCIÓN A PYPLOT
![Page 10: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/10.jpg)
10
Notese que 'Matplotlib' genera su propia ventana la cual por lo general posee una barra de herramientas en la parte inferior los cuales son:
'Home': Renderiza la gráfica a sus configuraciones originales deshaciendo operaciones de 'zoom' y/o 'paneo'.
'Back-Forward': Nos permite retroceder o avanzar entre las operaciones de 'zoom' y/o 'paneo', para poder navegar entre las vistas generadas por dichas operaciones.
INTRUCCIÓN A PYPLOT
![Page 11: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/11.jpg)
11
'Pan': Permite movernos en (x, y) a través de la grafica.
'Zoom': Permite ampliar zonas de la figura para poderlas ver con más detalle.
'Configure sobplots': Con esta herramienta podemos configurar manualmente parámetros de las graficas como: altura, anchura, espacios laterales, etc...
'Save': Nos permite exportar la imagen a formato de imagen como: raw, png, pdf, poscript, etc..
INTRUCCIÓN A PYPLOT
![Page 12: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/12.jpg)
12
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
MATPLOTLIB nos permite trabajar con varias gráficas en una sola ventana, a continuación crearemos dos gráficas,por lo que sera necesario crear un nuevo archivo con extensión '.py'
![Page 13: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/13.jpg)
13
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 14: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/14.jpg)
14
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 15: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/15.jpg)
15
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 16: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/16.jpg)
16
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
Así debería verse el resultado en pantalla.
![Page 17: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/17.jpg)
17
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
Ahora supongamos que necesitamos DEMASIADAS graficas, las cuales cuales no podrían verse bien en una sola ventana, lo cual nos obligaría a crear una segunda ventana, creamos un nuevo archivo '.py' y escribimos el siguiente codigo:
![Page 18: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/18.jpg)
18
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 19: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/19.jpg)
19
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 20: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/20.jpg)
20
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 21: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/21.jpg)
21
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
![Page 22: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/22.jpg)
22
CREACIÓN DE MULTIPLES GRAFICAS (Subplot)
El resultado debería verse así:
![Page 23: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/23.jpg)
23
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Podemos editar las propiedades estéticas de una figura, por ejemplo si tenemos algo así:
![Page 24: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/24.jpg)
24
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Que se ve así:
![Page 25: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/25.jpg)
25
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Cambiamos la apariencia modificando esta linea:
Por esta linea:
![Page 26: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/26.jpg)
26
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Ahora debería verse así:
![Page 27: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/27.jpg)
27
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Ahora añadamos algo de texto, ANTES de esta linea:
Agregamos lo siguiente:
![Page 28: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/28.jpg)
28
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Ahora debería verse así:
![Page 29: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/29.jpg)
29
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Con la siguiente linea:
![Page 30: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/30.jpg)
30
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Lo cual añadirá el titulo a la parte superior de la grafica:
![Page 31: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/31.jpg)
31
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Con el siguiente código:
![Page 32: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/32.jpg)
32
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Añadimos una pequeña ecuación en formato LATEX:
![Page 33: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/33.jpg)
33
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Y con el siguiente código:
![Page 34: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/34.jpg)
34
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Añadimos una segunda ecuación en formato LATEX:
![Page 35: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/35.jpg)
35
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Existen otras formas de agregar anotaciones a nuestra gráfica como por ejemplo:
![Page 36: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/36.jpg)
36
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Lo cual añadirá una anotación (con la flecha incluida) a nuestra gráfica:
![Page 37: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/37.jpg)
37
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
La gráfica se vera finalmente así:
![Page 38: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/38.jpg)
38
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
¡NO OLVIDEMOS ESTE código AL FINAL de nuestro archivo '.py'!:
![Page 39: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/39.jpg)
39
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Otra forma de es introducir un 'legend', para el siguiente ejemplo (No olvide crear un nuevo archivo '.py'):
![Page 40: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/40.jpg)
40
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Deberíamos tener el siguiente resultado:
![Page 41: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/41.jpg)
41
EDITANDO LAS PROPIEDADES DE LAS GRAFICAS
Deberíamos tener el siguiente resultado:
![Page 42: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/42.jpg)
42
MANEJO DE EVENTOS
Como lo mencionamos anteriormente MATPLOTLIB puede interaccionar con librerías externas como Gtk para poder desarrollar aplicaciones más complejas, para esto se provee de una API que permite trabajar con eventos comunes como hacer click en partes determinadas sobre la gráfica (picking),el movimientos del mouse sobre áreas predeterminadas ('mouse enter and leave'), arrastrar objetos ('Dragg'), etc...
A continuación crearemos archivos '.py' para los ejemplos que vamos a implementar:● Picking.py● Dragg.py● Hover.py ('mouse enter and leave')
![Page 43: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/43.jpg)
43
MANEJO DE EVENTOS: Picking
![Page 44: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/44.jpg)
44
MANEJO DE EVENTOS: Picking
![Page 45: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/45.jpg)
45
MANEJO DE EVENTOS: Picking
![Page 46: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/46.jpg)
46
MANEJO DE EVENTOS: Picking
![Page 47: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/47.jpg)
47
MANEJO DE EVENTOS: Picking
En pantalla deberíamos ver algo así:
![Page 48: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/48.jpg)
48
MANEJO DE EVENTOS: PickingY en la consola deberíamos ver esto al hacer click sobre los puntos de la gráfica:
![Page 49: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/49.jpg)
49
MANEJO DE EVENTOS: Dragg
![Page 50: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/50.jpg)
50
MANEJO DE EVENTOS: Dragg
![Page 51: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/51.jpg)
51
MANEJO DE EVENTOS: Dragg
![Page 52: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/52.jpg)
52
MANEJO DE EVENTOS: Dragg
![Page 53: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/53.jpg)
53
MANEJO DE EVENTOS: Dragg
![Page 54: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/54.jpg)
54
MANEJO DE EVENTOS: Dragg
![Page 55: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/55.jpg)
55
MANEJO DE EVENTOS: Dragg
![Page 56: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/56.jpg)
56
MANEJO DE EVENTOS: Dragg
En pantalla deberíamos ver algo así:
![Page 57: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/57.jpg)
57
MANEJO DE EVENTOS: Dragg
Y deberíamos arrastrar los rectángulos al hacer click sobre ellos:
![Page 58: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/58.jpg)
58
MANEJO DE EVENTOS: Dragg
Y en la consola deberíamos ver algo así:
![Page 59: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/59.jpg)
59
MANEJO DE EVENTOS: Hover ('mouse enter and leave')
![Page 60: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/60.jpg)
60
MANEJO DE EVENTOS: Hover ('mouse enter and leave')
![Page 61: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/61.jpg)
61
MANEJO DE EVENTOS: Hover ('mouse enter and leave')
En pantalla deberíamos ver algo así:
![Page 62: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/62.jpg)
62
MANEJO DE EVENTOS: Hover ('mouse enter and leave')
Al pasar el mouse sobre las figuras deberíamos ver esto:
![Page 63: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/63.jpg)
63
MANEJO DE EVENTOS: Hover ('mouse enter and leave')
Y en la consola deberíamos ver esto:
![Page 64: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/64.jpg)
64
ANIMACIONES
![Page 65: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/65.jpg)
65
ANIMACIONES
![Page 66: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/66.jpg)
66
ANIMACIONES
![Page 67: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/67.jpg)
67
ANIMACIONES
En pantalla deberíamos ver algo así:
![Page 68: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/68.jpg)
68
Plot 3D
![Page 69: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/69.jpg)
69
Plot 3D
![Page 70: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/70.jpg)
70
Plot 3D
![Page 71: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/71.jpg)
71
Plot 3D
En pantalla deberíamos ver algo así:
![Page 72: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/72.jpg)
72
Creación de Interfaces de Usuarios (UI)
Una de las características más interesantes recientemente implementadas dentro de MATPLOTLIB, es la capacidad de crear interfaces de usuario, permitiéndonos así crear aplcaciónes mucho más interactivas.
MATPLOTLIB posee dentro de sí la librería 'widgets', que nos permite crear controles de usuario básico controles de interfaz de usuario como por ejemplo: botones, 'sliders', 'checkbuttons', 'menus', etc...
Sin embargo AUNQUE SU ESTABILIDAD NO ESTA GARANTIZADA, MATPLOTLIB también puede servirse de librerias de terceros como qt, tkinter, gtk, etc...
![Page 73: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/73.jpg)
73
Creación de Interfaces de Usuarios (UI): Widgets
![Page 74: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/74.jpg)
74
Creación de Interfaces de Usuarios (UI): Widgets
![Page 75: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/75.jpg)
75
Creación de Interfaces de Usuarios (UI): Widgets
![Page 76: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/76.jpg)
76
Creación de Interfaces de Usuarios (UI): Widgets
![Page 77: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/77.jpg)
77
Creación de Interfaces de Usuarios (UI): Widgets
![Page 78: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/78.jpg)
78
Creación de Interfaces de Usuarios (UI): Widgets
![Page 79: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/79.jpg)
79
Creación de Interfaces de Usuarios (UI): Widgets
![Page 80: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/80.jpg)
80
Creación de Interfaces de Usuarios (UI): Widgets
![Page 81: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/81.jpg)
81
Creación de Interfaces de Usuarios (UI): Widgets
![Page 82: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/82.jpg)
82
Creación de Interfaces de Usuarios (UI): Widgets
![Page 83: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/83.jpg)
83
Creación de Interfaces de Usuarios (UI): Widgets
Finalmente este es el resultado que deberíamos ver en pantalla:
![Page 84: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/84.jpg)
84
Creación de Interfaces de Usuarios (UI): Tkinter
Tkinter es una librería integrada en Python que nos permite crear interfaces de usuario como alternativa a las librerías de 'matplotlib', en caso de que deseemos desarrollar interfaces de usuario más complejas y que se acerquen a una aplicación de escritorio comun.A continuación haremos un ejemplo similar al ejemplo anterior hecho con 'matplotlib', para mostrar las diferencias e cuanto sintaxis.
![Page 85: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/85.jpg)
85
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 86: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/86.jpg)
86
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 87: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/87.jpg)
87
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 88: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/88.jpg)
88
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 89: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/89.jpg)
89
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 90: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/90.jpg)
90
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 91: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/91.jpg)
91
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 92: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/92.jpg)
92
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 93: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/93.jpg)
93
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 94: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/94.jpg)
94
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 95: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/95.jpg)
95
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 96: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/96.jpg)
96
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 97: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/97.jpg)
97
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 98: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/98.jpg)
98
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 99: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/99.jpg)
99
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 100: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/100.jpg)
100
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 101: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/101.jpg)
101
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 102: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/102.jpg)
102
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 103: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/103.jpg)
103
Creación de Interfaces de Usuarios (UI): Tkinter
![Page 104: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/104.jpg)
104
Creación de Interfaces de Usuarios (UI): Tkinter
Finalmente este es el resultado que deberíamos ver en pantalla:
![Page 105: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/105.jpg)
105
Otras Interfaces de Usuarios (UI) Existen muchas más librerías de terceros para crear interfaces de usuario como wxWidgets, Gtk+, Qt, etc... sin embargo algunas no son lo suficientemente estables o no están bien soportadas por sus creadores para más documentación consultar:
http://www.wxpython.org/http://www.pygtk.org/https://live.gnome.org/PyGObjecthttp://zetcode.com/tutorials/pyqt4/http://qt-project.org/wiki/Category:LanguageBindings::PySidehttp://www.zonaqt.com/content/introducci%C3%B3n-practica-qt-en-python
![Page 106: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/106.jpg)
106
BIBLIOGRAFIA
[1] http://matplotlib.org/[2] http://matplotlib.org/users/pyplot_tutorial.html[3] http://matplotlib.org/examples/index.html[4] http://matplotlib.org/gallery.html
![Page 107: Tutorial de MatplotLib](https://reader033.vdocuments.net/reader033/viewer/2022051108/545f9eeaaf79593a708b4f30/html5/thumbnails/107.jpg)
107
SOBRE EL AUTOR Y EL CONTENIDO
A menos que se informe de otra manera esta obra está bajo una licencia de Creative Commons Reconocimiento-NoComercial-CompartirIgual 2.5
Colombia.
Diego Camilo Peña RamírezBogotá, Colombia
Abril de 2013
Twitter: @nervencid