-1

I would like to plot a dot on the line chart using Python, the data is as below:

                            Close   high_marked    low_marked   
Date                                        
2007-01-01 20:01:00         118.610     118.62      118.61  
2007-01-01 20:02:00         118.600      0.00        0.00   
2007-01-01 20:03:00         118.610      0.00        0.00   
2007-01-01 20:04:00         118.610      0.00        0.00   
2007-01-01 20:05:00         118.610      0.00        0.00   

The line chart is drawn on the 'Close' column, and I want to plot the dot of 'high_marked' as well as 'low_marked' whenever their the value is not 0.

I have tried

fig, axes = plt.subplots(figsize = (12,8))
axes.plot(table.Close, 'darkorange')
axes.plot(table.high_marked, 'g.')
axes.plot(table.low_marked, 'r.')

However, because the array on 'high_marked' and 'low_marked' contains 0 so the chart becomes enter image description here

How to get rid of the zeros that plot on the chart?

Thanks!

ShanN
  • 831
  • 1
  • 9
  • 20

1 Answers1

1

I think you can improve quite a bit on the actual post you made as I dont know what it is you are making, nor can i see output. I dont even know which language you are writing in.

However, my gut tells me your problem lies in the axes.plot function as you are supplying X as a list (or array) and y as a single value.

Please improve your post so it can be reused for others

Edit: Now that I have some more information (please add the matplotlib tag to the post btw) I think your solution is here: Not plotting 'zero' in matplotlib or change zero to None [Python]

Simply mark the 0's to nan - this should exclude them from plotting.

MrFronk
  • 382
  • 5
  • 23