Time series visualization with status update for multiple attributes - charts

Below is the sample data. I Need to plot a chart to visualize status changes for multiple attributes over a period of time. Below are the additional points the visualization should handle. I am not looking for any specific charting solution to implement the visualization but rather get an idea of how this can be handled.
In the below data, there are three attributes(r1,r2,r3), but I could have up to 30.
For each attribute, the status can be Pass/Fail/Error for a given month (period).
There could be as many as 100 months of data to plot.
Request,Date,Status
r1,Jan, Pass
r2,Jan, Pass
r3,Jan, Fail
r1,Feb, Pass
r2,Feb, Fail
r3,Feb, Pass
r1,Mar, Pass
r2,Mar, Error
r3,Mar, Pass
r1,Apr, Pass
r2,Apr, Error
r3,Apr, Fail
r1,r2,r3 are student results each month.

You could use a line/bar plot :
code Pass/Fail/Error with 0,1,2 and plot it on y axis,
on x axis put R1/R2/R3 stacked with date, even if you have 100 months
you have to put a switch where you can choose the month
By the way your question is too vague...what are R1,R2,R3? it seems that is something that must be put in production

Related

How to assign symbols to the data in Matlab

I am trying to plot some data with categories. However, I couldn't manage to plot my data according to the categories and show a legend for them. Therefore, I am asking a little bit help to this issue.
Example data;
Name
Brand
Mt
Enes
Renault
2.6
Avni
Tofaş
2.38
Asaf
Tofaş
3.06
My experience, I have managed to plot these data with two plot command overlaying each other grouping them by Brand. However, this time, one group of data has 2 line (as Tofaş has two data) and the other has only one line data (as in Renault). Thus, x-axis is confusing and not giving a healty graph.
The other issue with this, I can't label the x-axis according to Name when I plot two graph overlaying.
figure
plot(table.Mt, 'o');
xtickangle(90)
sizes = size(table.Name);
a1 = gca;
a1.XTick = [1:sizes];
a1.XTickLabel = table.Name;
the output of the code above
[Ism, Ind] =ismember(table.Brand, 'Tofaş');
plot(Ism, 'o')
the output of second code block above
As you can see, when I select only spesific Brand. The rest of arrray filling with zero (0) which I don't want to.
What I want is that plotting all data with spesific symbols for each Brand together.
Thank you
Enes

How to display variables as a continuous function in OpenModelica?

I'm creating a pipe model in OpenModelica using the method of characteristics. The method is currently working, but the results are displayed as single variables stored in several arrays. The arrays store variables as H_array[T,N] (head) where T is time and N is space.
I would like to view the results as a plot (shown in the image below on the right hand side) with head H on the y-axis and time T on the x-axis in the "Plotting" tab in OpenModelica, but as previously mentioned, the results are displayed as single variables as shown below. More specifically, I would like to look at a certain place (meaning N), say N=3, and observe how H_array[k,3] for k=2:T vary on the y-axis as a function of time T on the x-axis.
I'm expecting to observe a (semi)square pressure pulse as seen on the right side of the picture below. I know how to pick out every element with N=3 and put them in a separate array, but I do not know how to continuously display the values as a function of time. Can this be done with a derivative function in some way? Any tips?

MATLAB plotting data of continuos dates alongwith observed data of specific dates

I have simulated daily data corresponding to continuos dates but my observed data is only for some specific dates. How can i plot the continuos simulated data and insert observed data for specific dates on same plot in MATLAB. For example 01-01-05 date to 31-12-05 continuos simulated data and observed data only for 08-01-05, 08-04-05, 25-08-05, 03-11-05 specific dates.
You want to have a look at the description of ticklabels:
https://ch.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-labels-of-graph-1.html
You need to specify for which x-positions (xticks) you want to provide labels, and then use xticks and xticklabels together, like here:
x = rand(1, 100);
plot(x);
xticks(0:20:100);
labels = datestr(sort(rand(10,1)*now),2);
xticklabels(labels);
With the optional xtickangle you can slightly tilt the labels to create a nicer view of them and/or provide more
xtickangle(45);

Tableau percentage change of same measure

I have added a very simple example Tableau here: https://drive.google.com/file/d/1yG7EdIrKrTklhWOEoAmM4xwSbFZpOTvf/view?usp=sharing
In this example what I would like to achieve is to have a % change column which shows the % change.
I've tried using Quick table calculations but I cannot find any calculation that allows me to get the % change. I've also tried to use a calculated field with IF statements, but the calculation was returning blank cell.
P.S.
This is part of a more complex example in this thread: https://community.tableau.com/message/753038#753038
I have followed the answer in the link above and I was able to get to the point where I have the data showing up in two separate columns "Current Year" and "Prior Year".
But then I'm stuck on the supposedly easy step of simply calculating the % change between those two columns.
I was able to solve this issue by right clicking on the measure and selecting "Add Table Calculation".
Then I choose Calculation Type = "Percent Difference From", computing using = "Table (across)" and finally relative to = "Previous"

Converting from datenum back to actual time

Ok, so I've been messing with what should be a simple problem. I'm trying to plot an numerical array (double) vs. the associated time stamp (cell) with the format of the DD-MM-YY HH:MM:SS (for example: 13-Mar-15 07:23:10).
I'm able to plot a single set using datetime(time stamp). Due to the data set it outputs the nice HH:MM on the x-axis. Very nice.
Now in order to plot 2 sets of values on the same graph, I've found that Matlab doesn't like to use the date_time twice for the x-axis, so then I go to the infamous datenum function, which is able to plot both on the same graph. However, it's in the serial value of time and it jacks with my plot sizing (i.e. the x-axis doesn't autosize).
With what should be a simple problem has actually caused me days scouring the internet trying to reconvert it back to my beloved HH:MM after converting the "time stamp" into the serial time.
I don't think that a code sample or data set should be necessary for example purposes. (but can provide if needed)
I've tried to use the datetick function, but can't get seem to get it working.
The trick with datenum and datetick is to set limits and tick positions before you call datetick, then make sure it doesn't redo them.
So, after plotting your two sets of data against the datenums it would go something like:
step = 1/24; % for hourly - adjust to preference
ticks = datenum('mystarttime'):step:datenum('myendtime')
set(gca,'XTick',ticks)
datetick('x','HH:MM','keepticks','keeplimits')
I work a lot with time series and most often I have to plot my data versus time/date.
Since Matlab never gave me a definitively convenient solution, for many years now I work this way:
I defined once and for all a Matlab shortcut (in the matlab shortcut toolbar):
containing the following code:
xticktemp = get(gca,'Xtick') ;
ticklabel = {datestr(xticktemp(1)) datestr(xticktemp(2:end),15) } ;
set(gca,'Xticklabel',ticklabel)
clear xticktemp ticklabel
I convert all my times with datenum and use this format for working (or posix time when more convenient, but it's another story), calculating and plotting. When I need to now exactly the time of an event in a human readable format, I press the shortcut and I obtain something like:
Of course there are 2 major limitations with this method:
This does not control the steps of the ticks (it just replicate what Matlab initially set)
You have to re-click your shortcut to refresh the tick labels everytime you zoom or pan the figure
For these reasons, when I need to finalize figure for presentation to others I won't use this trick and define my ticks exactly like I want them, but when you are simply working away, this shortcut has saved me hours (may be even days?) of fiddling around over the last 10 years ....