How to plot graph x,y for text file
Afficher commentaires plus anciens
Hi! I want to plot graph but I don't read file from file txt.
This is my code.
import matplotlib.pyplot as plt
import numpy as np
with open('t.txt','r',encoding = 'utf8') as f:
data = f.read()
data = data.split('\n')
x = [float(raw.split()[0]) for raw in data]
y = [float(raw.split()[1]) for raw in data]
plt.plot(x,y,'ro')
plt.show()
And my data in text file, t.txt.
Please help me
Thankyou
1 commentaire
ANKUR KUMAR
le 29 Sep 2018
The code in your question is python code.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!