Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have data in excel sheet, having two columns (YEAR, nT), now I want to plot these two but I'm not getting the required graph, the code is

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

M1 = pd.read_csv('MF.csv', parse_dates=['YEAR'], index_col='YEAR')

M1 = pd.read_csv('MF.csv', parse_dates=['YEAR'], index_col='YEAR')

M1.plot(linewidth=1,color="k",xlabel = 'Time',ylabel = 'Scalar B, nT', title = 'Hourly Magnetic field from 1964 to 2021'). 

from pylab import rcParams
rcParams['figure.figsize'] = 14,10
plt.savefig('Hourly.png', format='png', dpi=1200)
plt.grid(False)
plt.show()


What I have tried:

The resulting graph which I'm getting is Hourly Magnetic field which is not Smooth, my data is from 1964 to 2021.

Is there any other approach for getting smooth and better graph?
Posted
Updated 5-Mar-22 7:25am
v2
Comments
[no name] 5-Mar-22 16:05pm    
You didn't say how many points you have; the more points, the better it looks; assuming they have some relation to time.
Junaid Ihsan 5-Mar-22 23:35pm    
I have rows of about 500167

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900