i want to plot graph on graph widget of my application but on my output window labels are added to graph widget but no data is plotted

17 views Asked by At

I want to plot a line graph of wind speed with respect to time for this i write the code:

    hour = self.df.iloc[:, 1]
    Windspeed = self.df.iloc[:, 5]
    self.Graph_Widget.setBackground('w')  # Set background color
    styles = {'color': 'r', 'font-size': '50px'}
    self.Graph_Widget.setLabel('left', 'Wind Speed (m/s)', **styles)  # Set Ylabel
    self.Graph_Widget.setLabel('bottom', 'Minutes (H)', **styles)  # Set xlabel
    self.Graph_Widget.plot(hour, Windspeed, color='blue') # plot graph
    self.Graph_Widget.showGrid(x=True, y=True)  # Show Grid lines
    self.Graph_Widget.setXRange(0, 20, padding=0)  # X-axis range
    self.Graph_Widget.setYRange(0, 10, padding=0)  # Y-axis range

but i got error: isfinite = np.isfinite(x) & np.isfinite(y) ^^^^^^^^^^^^^^ TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' printExc('Ignored exception:')

i add this to the code: hour.astype(float) Windspeed.astype(float) and got another error that is: return arr.astype(dtype, copy=true) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ valueerror: could not convert string to float: '00:00:00'

0

There are 0 answers