How can I plot data of multiple days on same plot - matlab-figure

I have some data which is collected for 6 days during 8:00AM to 11:00AM. I need to plot all the data on same plot one over other. The way I am doing now:
hold on
plot(y1,x1,':b*','MarkerEdgeColor','k')
plot(y2,x2,':r*','MarkerEdgeColor','k')
plot(y3,x3,':y*','MarkerEdgeColor','k')
plot(y4,x4,':g*','MarkerEdgeColor','k')
plot(y5,x5,':c*','MarkerEdgeColor','k')
plot(y6,x6,':w*','MarkerEdgeColor','k')
datetick('x','HH:MM:SS')
hold off
where x1 to x6 has y axis data and y1 to y6 have
y(i) = datenum(Year(1:5), Month(1:5), Input_Vector(1:5,2), Input_Vector(1:5,3), Input_Vector(1:5,4), Input_Vector(1:5,5));
When I plot using above, I get the image attached
But what I need to find patterns by observing them. So I need to have something one above other with x axis 8:00:00 to 11:00:00
I need something like and I got this by making DAY parameter constant date.

If you want to plot one day over another, then the method you used to make the second graph - discarding/replacing the date part of your datetime - is likely the best way to do it. It matches up nicely with the conceptual question that the graph answers, i.e.: "Is there a link between time of day and duration of journey, regardless of the day it was taken on?"
If you still want to preserve the day information, you could always perform the multiple plots with different line specs, and have the legend show which line corresponds to which day.
If the above question - finding a link between time and journey duration - is what you are trying to do, rather than plotting that specific type of graph, I would also try something like this:
Split your day into half hour or quarter hour slots and take the average of all data points in each block. This gives you a single value for each half/quarter hour span.
Plot this as a bar chart with error bars showing standard error (this can be done using bar and errorbars)
If I see anything, try fitting it with an appropriate model and check for goodness of fit. In your case this would probably be a Gaussian model, as your data kinda looks like it peaks around 9:20.

Related

How can I align linear and ordinal scales in d3 graphs?

I have an ordinal scale, that I am creating a bar chart with.
I create it like this:
d3.scale.ordinal()
.rangeRoundBands(js.Tuple2(0, widthOfMySvgElem), 0.1)
.domain(labels)
The labels are in fact weeks, or months, or similiar periods, and I have data for those periods.
Now, I have something like expected values, that I want to show in this graph as well.
Furthermore, those expected values can change in time, and I want to display that too.
I want to display, that I have expectedValue1 in march, and the start of April, but then at 7th of April, the expected value changed to expectedValue2, and I want to place it where the 7th of April would be on my axis. (I want to display those expected values as the straight line, that changes height as value change.)
But I have no luck matching exact location in relation to this ordinal axis.
Do you have any ideas how can I successfully align those two scales, so they will meet at the data points of ordinal scale, but that I would be able to position other values correctly as well?

Time scale axis ticks positions

I can't figure out why second last tick in not equally spaced In This Link? I am using d3 time scale.
Assuming you're referring to the space between the "Mon 26" tick and the unlabeled tick, it's because the last tick just represents the end of the axis, not another whole day. Since you don't have any data after the 26th, d3 didn't make the axis extend a full additional day.
This last tick is called an outer tick. If you want to get rid of it, you can set its size to 0: axis.outerTickSize(0)

Create D3 x-axis that excludes weekends and holidays

I am trying to create a simple d3 chart using the library NVD3 (the information that I am using NVD3 is somewhat irrelevant), and I am struggling to create the correct x-Axis and get the correct spacing between points. I do want a scaled display of dates, so, the jump from 2014-03-01 to 2014-04-01 would be less than to 2014-03-07. So essentially what I want is the typical default time scale, except I don't want it to consider weekends and holidays as possible points, because the market is closed on these days.
I apologize in advance that I cannot post code, as the data is from a source I can't put into a fiddle or bin.
Essentially the data that I am returned is not garunteed to have the price of a stock on a valid date, and some points could be missing. Currently a single day tick on the x-axis is twice as large as the regular single day tick should be if there is data on a Monday and a Friday.
If this is confusing please tell me and I will try and reword.
If anyone has done this before or has any insight, all help is appreciated!

kendo chart need to separate the category series from the value series

I need to setup my line chart with category values that are daily even though there might be multiple values for each day. I still need the graph to show each data value separately. For example, if I have five values in one day I need those five points to appear on the graph in time-order between two category axis lines. I do not want a separate category axis line for each value point. The best example I can give is with blood pressure readings. Someone may test their blood pressure five times in one day. I want those five points to appear in their relative time-order between two categories that represent today and tomorrow rather than have five different categories, one for each value point.
Is this possible? I cannot see how through the documentation, blogs, and stackoverflow question.

d3.js - Irregular layout on column chart when columns represent months

Check out this quick and dirty example that I threw together: http://zoopoetics.com/d3/irregular_layout.html
d3 is doing its job admirably, laying out the columns at irregular intervals because months are of irregular durations. As we all know, a month can last from 28 to 31 days.
Thing is, the irregular layout is unsettling to the eye. I want the columns to lay out at regular pixel intervals along the horizontal axis.
Looked all over the googles for an answer and found very little about this problem, which suggests that I may be missing something obvious.
Has anyone else been here and surmounted the problem? Thanks!
My first approach would be to use the time x axis but render the bars against a different scale of lets say 365/12 intervals.
The x scale I think should have the month name labels in the middle of each month as well as a tick at the middle:
Here is my version of your file
here

Resources