This is a python matplotlib question. So it would be great if you could show me in python method.
I have this loadtxt that asked to plot histogram of wind gusts(column 3) that lie in direction angle(column 2) from min angle to max angle inclusively. I don't know how to include min_angle and max_angle into my codes.
import numpy as np
import matplotlib.pyplot as plt
from math import sin,pi
import math
def
plot_wind_gust_histogram(filename,min_angle,max_angle):
data1=np.loadtxt(filename,delimiter=";",skiprows=1,usecols=2)
#speed
data2=np.loadtxt(filename,delimiter=";",skiprows=1,usecols=1)
#direction add this
data1=data1[np.where(np.logical_and(
data2[:]>=min_angle , data2[:]<=max_angle
))].astype(np.int) #add this
axes=plt.axes()
axes.hist(data1, bins=range(0,141,10) ,
facecolor='blue')
axes.grid(True)
axes.set_title("Wind gusts from file
akaroawindgusts.txt in direction 180 and 270")
axes.set_xlabel("Wind gust speed (km/h)")
axes.set_ylabel("Count")
axes.set_xticks(np.arange(0,141,10))
axes.set_yticks(np.arange(0,70,10))
plt.show()
plot_wind_gust_histogram("akaroawindgusts.txt",180,270)
This is a python matplotlib question. So it would be great if you could show me...