Jan-22-2020, 10:58 AM
Hi,
Id like to know how i can plot data from a list.
I know how to plot data which is on one line, like 1,2,3,4,5,6. But not in a list.
Example data to plot:
1
2
3
4
5
6
And how i can change the timestamp output from script below from unix to local.
Thanks.
Id like to know how i can plot data from a list.
I know how to plot data which is on one line, like 1,2,3,4,5,6. But not in a list.
Example data to plot:
1
2
3
4
5
6
And how i can change the timestamp output from script below from unix to local.
Thanks.
import pandas as pd import requests import json import matplotlib.pyplot as plt import numpy as np import datetime import time from datetime import datetime url = 'https://api.darksky.net/forecast/1967baef0ec1a24e097666a982fb/5483143,322984?units=si' response = requests.get(url) weather_data = response.json() time =[weather_data['hourly']['data'][k]['time'] for k in range(0,48)] temperature_min = [weather_data['hourly']['data'][k]['temperature'] for k in range(0,48)] temperature_max = [weather_data['hourly']['data'][k]['dewPoint'] for k in range(0,48)] rain_prob = [weather_data['hourly']['data'][k]['precipProbability'] for k in range(0,48)] print(temperature_min) print(time) fig, ax = plt.subplots() ax.plot(time, temperature_min,linewidth=1.0 ) ax.plot(time, temperature_max,linewidth=1.0) ax.plot(time, rain_prob) ax.grid() plt.show()