Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Laboratorio 4 - 2020 - 2do cuatrimestre
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Schmiegelow
Laboratorio 4 - 2020 - 2do cuatrimestre
Commits
750b2ad9
Commit
750b2ad9
authored
Sep 02, 2020
by
Christian Schmiegelow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
8cadd631
Pipeline
#40
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
0 deletions
+91
-0
dataPlotter.py
clase0/python/dataPlotter.py
+91
-0
No files found.
clase0/python/dataPlotter.py
0 → 100644
View file @
750b2ad9
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 24 17:45:37 2020
@author: labo4_2020
"""
"""
Para plotear les recomendamos el módulo pyplot de la librería matplotlib, el cual tiene
amplia documentación online. Se suele importar con la abreviación plt.
"""
import
matplotlib.pyplot
as
plt
import
numpy
as
np
#%%Creo vectores ficticios para graficar
Tiempos
=
np
.
linspace
(
0
,
25
,
1000
)
#creo un vector de 0 a 100, con 1000 pasos.
Voltaje1
=
2
*
np
.
sin
(
Tiempos
)
#numpy permite aplicar funciones a arrays hechos en numpy
Voltaje2
=
5
*
np
.
cos
(
Tiempos
)
#%% Graficamos y guardamos la figura:
plt
.
figure
()
# graficamos la serie Voltaje1
plt
.
plot
(
Tiempos
,
Voltaje1
,
color
=
'blue'
,
linewidth
=
2
,
linestyle
=
'dashed'
,
label
=
'Medición 1'
)
# graficamos, en los mismos ejes la serie Voltaje2
plt
.
plot
(
Tiempos
,
Voltaje2
,
color
=
'red'
,
linewidth
=
2
,
linestyle
=
'solid'
,
label
=
'Medición 2'
)
# agregamos una linea vertical al gráfico que marca algo.
plt
.
axvline
(
6.28
,
color
=
'green'
,
linestyle
=
'dotted'
,
linewidth
=
1.5
,
label
=
'Un período'
)
# Fijamos cuestions cosméticas del grafico: etiquetas, limites, etc.
plt
.
xlabel
(
'Tiempo (s)'
)
plt
.
ylabel
(
'Voltaje (V)'
)
plt
.
xlim
(
0
,
25
)
plt
.
ylim
(
-
6
,
9
)
plt
.
title
(
'Medición de cuarentena'
)
plt
.
legend
()
#coloca las etiquetas en la mejor posición posible
# guardamos la figura graficada como un archivo
plt
.
savefig
(
'plots/figurita1.png'
,
format
=
'png'
)
#esta línea guarda la figura
# trae la figura al frente.
plt
.
show
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment