Python Forum
numpy.float64 and plot_date in matplotlib
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.float64 and plot_date in matplotlib
#2
You do not convert your  date to matplotlib dates, value of your date is 20170608?, plt.plot_date takes it as number of days from 1.1.1, that is 55224 years, out of range of python datatetime.

Morever even with correct converting you would plot only last bar (you are not keeping older values). And with that strange way to convert datetime to matplotlib dates through string and loadtxt you are discarding time part of timestamp, so you could end with hundreds of bars with same date. Perhaps better way is to use something like
matplotlib_date = mdates.date2num(datetime.fromtimestamp(day + 240 * offset))
to convert posix timestamp to matplotlib date (real number where fractional part represents part of day).

You probably should split your function and have one function to convert downloaded data and second one to plot.
Reply


Messages In This Thread
RE: numpy.float64 and plot_date in matplotlib - by zivoni - Jun-21-2017, 10:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 545 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,604 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  numpy.float64 object is not iterable jcdr91 1 13,225 Apr-22-2020, 04:09 PM
Last Post: jefsummers
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 2,976 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  ValueError: Input contains infinity or a value too large for dtype('float64') Rabah_r 1 12,898 Apr-06-2019, 11:08 AM
Last Post: scidam
  Numpy and matplotlib in incorporated Python. CSKir 7 5,599 Jan-15-2019, 10:44 AM
Last Post: CSKir
  ???Can not convert from <U25 to float64.??? damsel_pie 6 6,909 Aug-23-2018, 04:49 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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