Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plot data from list.
#1
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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 318 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  Likert survey data plot error Andrzej_Andrzej 6 1,306 Jul-16-2023, 10:11 PM
Last Post: deanhystad
  Plot a pandas data fram via pyqtgraph with an modul import and qt designer widget Nietzsche 0 801 May-29-2023, 02:42 PM
Last Post: Nietzsche
  Create simple live plot of stock data dram 2 2,858 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 896 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Why changing data in a copied list changes the original list? plumberpy 3 2,190 Aug-14-2021, 02:26 AM
Last Post: plumberpy
  Plot data from CSV allen04 2 2,343 Jan-03-2021, 10:30 AM
Last Post: Axel_Erfurt
  How to plot intraday data of several days in one plot mistermister 3 2,854 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Creating Complex Color Spectrum Plot From Data JoeDainton123 2 2,076 Sep-15-2020, 08:09 AM
Last Post: DPaul
  How to plot data from live datasource? Makada 14 5,749 Sep-06-2020, 07:13 PM
Last Post: Makada

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020