I have a simple set of values that I display on a bar plot or a line plot. Sometimes, depending on the outcome of steps in the code, some values will be set to NaN.
When they appear in the middle of the data series (ex: [1 2 3 NaN 8 9]), the plot shows 6 "data points", with the 4th not being plotted. However, there is a corresponding x-axis location for this missing NaN point.
However, when the NaN appears at the end of the data series (ex: [1 2 3 6 8 NaN]), the plot will onl show 5 "data points", with the 6th not only non being plotted, but completely missing a corresponding x-axis location. This creates problems, as I need the x-axis to be consistent, and will subsitute the x-axis locations with custom xtick labels that should show all the possible x-axis values. Also, I would like to subsitute a text box to appear where there is missing/NaN data, to add a note about why this is missing. Obviously all of this is not possible if the location for the data point is removed and the series is simply truncated.
Any pointers are appreciated. Thanks.