0

Below is a snippet of the code I am using to analyze the volume of ES (s&p futures).

esVolume = (es['Volume']).loc['2023-03-15 09:00:00-04:00':'2023-03-15 10:29:00-04:00']

plt.plot(Time.minute(900,1030), esVolume)

Why does the x-axis include increments 960-999 when the domain of the graph is [900,959] U [1000,1030] ?

plot

quant
  • 17
  • 5

1 Answers1

0

Matplotlib tries to create a continuous range of x and the plot. To override this behavior you need to manually define the xticks for matplotlib

arr = [100*(i//60) + i%60 + 900 for i in range(0,10000)]
plt.plot(arr,arr,'ro')
plt.xticks(arr[::5])
plt.show() 

enter image description here

Equinox
  • 6,483
  • 3
  • 23
  • 32
  • My data increments are 1 min intervals so I want 1000 to follow 959 (no break in the graph). – quant Mar 23 '23 at 21:58