100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Matplotlib con Phyton $7.99   Add to cart

Case

Matplotlib con Phyton

 6 views  0 purchase
  • Course
  • Institution

Matplotlib es una biblioteca de visualización en Python que permite crear gráficos estáticos, animados e interactivos. Es muy utilizada para generar gráficos en 2D y 3D, como líneas, barras, histogramas, dispersión, entre otros. Características Clave: Gráficos de líneas: Crear gráfi...

[Show more]

Preview 3 out of 18  pages

  • July 23, 2024
  • 18
  • 2023/2024
  • Case
  • Juan
  • A+
avatar-seller
Matplotlib

Unidad 6




Apunte de cátedra




Pensamiento computacional (90)
Cátedra: Camejo

,Matplotlib APUNTE DE CÁTEDRA



Estructura de este apunte
Este apunte fue armado primero como un Google Colab antes de ser pasado a PDF. Esto significa
que pueden ir al siguiente link y conseguir una versión más interactiva si así prefieren. Es
importante destacar que no van a poder modificar el archivo porque solo tiene permisos de
lectura, deben crear una copia primero. Una vez hecha la copia van a poder cambiar el código y
probar cosas por su cuenta.



¿Qué es Matplotlib?
Matplotlib es probablemente la biblioteca de Python más usada para crear gráficos en 2D,
también llamados plots. Provee una forma rápida de graficar datos en varios formatos de alta
calidad que pueden ser compartidos y/o publicados. En esta sección vamos a ver los usos más
comunes de matplotlib. En este video encontrarán una introducción breve a esta sección.

pyplot
pyplot proporciona una interfaz a la biblioteca de matplotlib. Pyplot está diseñada siguiendo el
estilo de Matlab y la mayoría de los comandos para graficar en pyplot tienen análogos en Matlab
con argumentos similares. Explicaremos las instrucciones más importantes con ejemplos
interactivos.
from matplotlib import pyplot as plt

Las primeras funciones que vamos a ver son plot y show.
La función plot recibe 2 arreglos que tienen que ser del mismo tamaño que representan una
serie de puntos en el plano cartesiano. El primer arreglo son las coordenadas X y el segundo son
las coordenadas Y. Finalmente lo que hace la función es unir todos estos puntos con lineas para
que en el dibujo podamos ver el gráfico de la función.
show simplemente crea la imagen con todos los gráficos definidos anteriormente.
x = [0,2,10,11,18,25]
y = [0,1,2,3,4,5]

plt.plot(x, y)

plt.show()

Resultado:




2

, Matplotlib APUNTE DE CÁTEDRA




Si aumentamos la cantidad de puntos entonces nuestra linea va a ser más suave. En este caso
2
podemos usar 21 puntos para graficar 𝑓(𝑥) = 𝑥
x = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [100,81,64,49,36,25,16,9,4,1,0,1,4,9,16,25,36,49,64,81,100]

plt.plot(x, y)

plt.show()

Resultado:




3

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller lucach. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80435 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart