MATLAB Answers


plotting a temperature graph over a data of years

Asked by nouman shehzad on 22 Jun 2019
Latest activity Commented on by Fikret Dogru on 27 Jun 2019
i have data of about 18 years i want to make a temperature graph versus time.
my matlab code for doing this is
i am getting very complex graph which is hard to interpret anything so i need assistance in doing this work. the file having the years data with temperature is attached.


Look for bar plot, which may be easier to interpret. x axis time and y axis temp. Though the data set is quite long, is it date wise/ min / hour?

Sign in to comment.


1 Answer

Answer by Fikret Dogru on 22 Jun 2019

Could you show the plot to give you feedback?


here is the graph which i am getting. graph is attached looking for the help brother
the data is is arranged yearwise and we have to show the plot temperature vs year. can u please tell me by writing the code that how we can plot it.?
Thanx for showing the plot. First you should convert your date using date2num then
Dates for example 20160702 means 2016 year 07 month 02 day
Dates=str2num("your dates");
h1=plot(xtime,"your variable (temperatures)");
hold on
mmm gives only months with 3 character if you want to yearly make it
datetick('x','yyyy','keepticks') there are several options can u find in the help yyyy-MMM or etc.
Hope it helps u.

Sign in to comment.