Plot data from list. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Plot data from list. (/thread-23899.html) |
Plot data from list. - Makada - Jan-22-2020 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. 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() |