Plotting of multiple graphs on a single tablet screen - androidplot

I m designing an application that is suppose to plot multiple graphs for sensor data on a single tablet screen.All the graphs shall have common x-axis that displays time(1 sec to 2 mins) but y axis data for all the plots is different. I was able to successfully plot all the graphs but not sure how to display a common x- axis for the graphs? Has anyone tried doing this?

You can definitely display multiple plots (each containing it's own graph space) with identical domain (xAxis) labeling. The key to doing this is constraining each plot's boundaries in the same way.
Let's say that for the sake of this example your series data uses a time offset in milliseconds as it's x values. For 1 second that gives us:
xMin = 1000 (1 second)
xMax = 120000 (2 minutes)
which translates to:
plot.setDomainBoundaries(1000, 12000, BoundaryMode.FIXED);
If you're using real timestamps instead of offsets, the same principle applies. You'll just have to decide what the starting timestamp should be and then calculate the ending timestamp by adding 120000 to it.

Related

Excel Dual Y Axis (one on top of the other)

I am wanting to create a line graph with the same variables, but two different machines. There are 16 total variables so overlapping 16 lines would look so messy. I don't want the user to have to copy and paste two charts at the end of each week to email, so I am wondering if it would be possible to create a chart like the one attached. Any help is awesome, thank you!
Yes, but it may not be as pretty as you want. Just assign half the series to the secondary axis, then change the display ranges for the two axes. Here is how you figure out what to set them to.
Axis 1 minimum = Actual Data Minimum - Actual Data Maximum
Axis 1 maximum = Actual Data Maximum
Axis 2 Minimum = actual data minimum
Axis 2 maximum = Actual data maximum * 2
Since you have percentages in your example, this would be:
Primary axis minimum = -100%, maximum = 100%
Secondary axis minimum = 0%, maximum = 200%
Then you can play around with where the labels display etc to try to clean it up, but it won't look nearly as good as 2 charts (which you have ruled out).

Gnuplot: calculated X tic labels for data file without X column [duplicate]

I'm plotting a column of data which represents a time series in gnuplot. Every value represents a time value after 500 iterations / time units. Can I tell gnuplot to multiply the x-values it displays by 500?
I thought this would be a standard problem since every time one has to plot a time series one needs to tell the plotting program what time unit each iteration has.
I don't want to create an extra column with x-values manually, since I have a lot of different data of different length. I don't want to create a x column for everyone of them.
If you have only a single column, gnuplot uses the row number as x value. This can be accessed by the pseudo column 0 and scaled like
plot 'datafile' using ($0*500):1
or equivalently, if you're calling this from a shell script
plot 'datafile' using (column(0)*500):1

Excel - Plot average of two plots with inconsistent time (X) axis

I have managed to plot two different data sets on the same axis however, I'm also looking to plotting another line showing their average.
The main problem is that both data sets have different X (time) values so it's not possible to add an average column at the end and plot that. (See the highlighted row 22 for example, corresponding Time values are different)
Is there any way I can plot an average of two plots on the same axis?
One idea that might work is to place the values of both series, one above the other in two new columns, sort this new data according to time, smooth it, then plot the smoothed combined data. Alternatively, you could do the smoothing by simply plotting the new sorted series, adding a moving average trendline to it, then change the formatting of the new series so that it is no longer visible (but the trendline is). Something like this:
In the above picture, series 3 is the plot of the sorted aggregate data of series 1 and 2. If you change the formatting of series 3 so that there is no line, you get something like this:
For my relatively small mock data sets, the results are admittedly poor (it was based on just 25 data points in each series), but if you have a large amount of closely spaced data, and you play around with the moving average window size, you might get something acceptable. If not, you should probably just interpolate both datasets to obtain two consistent time series.

Computing average grid size

I am trying to compute the average cell size on the following set of points, as seen on the picture: . The picture was generated using gnuplot:
gnuplot> plot "debug.dat" using 1:2
The points are almost aligned on a rectangular grid, but not quite. There seems to be a bias (jitter?) of say 10-15% along either X or Y. How would one compute efficiently a proper partition in tiles so that there is virtually only one point per tile, size would be expressed as (tilex, tiley). I use the word virtually since the 10-15% bias may have moved a point in another adjacent tile.
Just for reference, I have manually sorted (hopefully correct) and extracted the first 10 points:
-133920,33480
-132480,33476
-131044,33472
-129602,33467
-128162,33463
-139679,34576
-138239,34572
-136799,34568
-135359,34564
-133925,34562
Just for clarification, a valid tile as per the above description would be (1435,1060), but I am really looking for a quick automated way.
Let's do this for X coordinate only:
1) sort the X coordinates
2) look at deltas between two subsequent X coordinates. These delta will fall into two categories - either they correspond to spaces between two columns, or to spaces between crosses within the same column. Your goal is to find a threshold that will separate the long spaces from the short ones. This can be done by finding a threshold that separates the deltas into two groups whose means are the furthest apart (I think)
3) once you have the threshold, separate points into columns. A columns starts and ends with a delta corresponding to the threshold you measured previously
4) calculate average position of each detected column
5) take deltas between subsequent columns. Now, the problem is that you may get a stray point that would break your columns. Use a median to get the strays out.
6) You should have a robust estimate of your gridX
Example, using your data, looking at axis X:
-133920 -132480 -131044 -129602 -128162 -139679 -138239 -136799 -135359 -133925
Sorted + deltas:
5 1434 1436 1440 1440 1440 1440 1440 1442
Here you can see that there is a very obvious threshold between small (5) and large (1434 and up) delta. 1434 will define your space here
Split the points into columns:
-139679|-138239|-136799|-135359|-133925 -133920|-132480|-131044|-129602|-128162
1440 1440 1440 1434 5 1440 1436 1442 1440
Almost all points are alone, except the two -133925 -133920.
The average grid line positions are:
-139679 -138239 -136799 -135359 -133922.5 -132480 -131044 -129602 -128162
Sorted deltas:
1436.0 1436.5 1440.0 1440.0 1440.0 1440.0 1442.0 1442.5
Median:
1440
Which is the correct answer for your SMALL data set, IMHO.

Comparative histogram of two data files, one with frequency, the other with boxes

I have two sets of data, and aim to make a comparative histogram from them. However one is a two-column data, x and its frequency, the second one is a one-column unsorted data which gnuplot should derive out the frequencies. I want a continuous histogram, but whatever I find on the web has gaps.
how should I do this?
I tried using the following script
binwidth=5
bin(x,width)=width*floor(x/width)
plot'data1.txt' with boxes, 'data2.txt' using (bin($1,binwidth)):(1.0) smooth freq with boxes
with the data files data1.txt:
1 3
5 1
7 1
and the second data file data2.txt:
1
1
1
5
7
This doesn't give the expected result.
Use the smooth frequency option, which makes the data monotonic in x; points with the same x-value are replaced by a single point having the summed y-values. So, if you use the first column as x-values and 1 as y-value you get the count:
plot 'secondfile.dat' using 1:(1) smooth frequency with linespoints
The plotting style is almost independent of the plotting style, so you can use points, lines, boxes etc.

Resources