How do I insert a placeholder in a plot where I don't have data?

I'm making a plot from two columns/variables in my data table where one of the variables is the day that the data was collected on. I want to look for trends/patterns in my data as the number of days increases. However, there are certain dates on which I did not collect any data. So I'd like to insert a place holder on the dates when no data was collected and include these in my plot. Is this possible?

댓글 수: 7

What do you want the "placeholder" to be -- a showing or non-showing value?
See retime and friends or section on cleaning data ... you are using a timetable, right?
Are you doing a scatter plot? How do you want the placeholder represented on the plot? I guess I do not completely understand your question.
I am just creating a regular plot and I guess the only other word I can think of for what I want to insert is a "hole" where I have missing data. I am making a plot of number of trials (number of times data was collected in a day) vs. number of days. Data was collected over about a 3 month period, but there were certain days for which data is missing/nothing was collected. I'd like to insert a hole/placeholder in my plot for these days that follows the trend of my data and shows what number of trials likely would've been collected on the days where data is missing, but is distinguished from an actual data point. Sorry, for the confusion, I hope that helps and will look into retime as well!
Just use markers for your data and make sure x-axis ticks include every day.
So no, I'm not using a timetable. Simply, a data table.
I know how to use markers and change the x-axis ticks. I'm trying to find a way to prevent my plot from dropping off to zero on the y-axis because I'm dealing with daily data. It looks like I might need to work with a timetable rather than a data time like dbp mentioned.
" I'm trying to find a way to prevent my plot from dropping off to zero on the y-axis..."
That's why I asked about "showing" versus "nonshowing" markers.
Use NaN or (NaT if x-axis is datetime)
It would be much easier to write actual code example if we knew what your data format looked like -- still for the purpose the timetable or a table with the time/date column as a datetime would make it drop-dead simple.

댓글을 달려면 로그인하십시오.

답변 (1개)

the cyclist
the cyclist 2020년 6월 16일

0 개 추천

You could use interpolation to identify where the "trend" would be at the missing data point, and plot the interpolated values as a different symbol.

카테고리

도움말 센터File Exchange에서 Data Preprocessing에 대해 자세히 알아보기

질문:

2020년 6월 16일

댓글:

dpb
2020년 6월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by