What would be the easiest way to create a spider plot (or radar/star plot) from an org-mode table using org-plot/gnuplot?
The org-plot docs suggests it should be possible using a script: option but it's not clear to me how the table columns can be converted into arrays in a gnuplot script (using this example code as a starting point)
The input would look something like this...
#+PLOT: title:"spiderplot" set:"output './img/spiderplot.png'" script:"spiderplot.gp"
#+TBLNAME: three-fold
| Array1 | Array2 | Array3 |
| 15 | 25 | 30 |
| 75 | 25 | 35 |
| 20 | 50 | 55 |
| 43 | 50 | 55 |
| 90 | 75 | 80 |
| 50 | 50 | 25 |
and produce an image something like this...
set spiderplot
set style spiderplot fillstyle transparent solid 0.30 border
set for [i=1:6] paxis i range [0:100]
set for [i=1:6] paxis i label sprintf("Score %d",i)
set paxis 1 tics
set grid spider lt black lw 0.2
set datafile sep '|'
plot for [row=1:6] 'orgplot.dat' using 2 every 1::row::row lt 1, newspiderplot, \
for [row=1:6] 'orgplot.dat' using 3 every 1::row::row lt 2, newspiderplot, \
for [row=1:6] 'orgplot.dat' using 4 every 1::row::row lt 3
Based on Ethan's answer, org-plot creates a temp file which can be referenced as $datafile in the gnuplot script. The sep isn't required (as it's set on export) and the png options may need to be set...
set spiderplot
set style spiderplot fillstyle transparent solid 0.30 border
set for [i=1:6] paxis i range [0:100]
set for [i=1:6] paxis i label sprintf("Score %d",i)
set paxis 1 tics
set grid spider lt black lw 0.2
set terminal png notransparent truecolor enhanced large
plot for [row=1:6] '$datafile' using 1 every 1::row::row lt 0, newspiderplot, \
for [row=1:6] '$datafile' using 2 every 1::row::row lt 1, newspiderplot, \
for [row=1:6] '$datafile' using 3 every 1::row::row lt 2
Related
I have two columns in my InfluxDB database : Values and Iterator count
I want visualise this on Grafana where my x axis is iterator count and value on y axis is basically corresponding to each iterator count.
EXAMPLE
Iterator Count(X) | Value
1 | 46
2 | 64
3 | 32
4 | 13
5 | 12
6 | 11
7 | 10
8 | 9
9 | 12
10 | 25.
Is it possible to achieve visualisation for the same, having no aspect of time
You can use plot.ly plugin
You just need to specify Iterator Count(X) as the x-axis in the trace section and Value as the y-axis.
I am trying to visualize my data based on an aggregation of their corresponding values. My input data looks like this:
| id | value |
34 0.5
35 0.6
37 0.7
38 1.1
39 1.2
40 2.5
The goal would be to transform it into this table:
| value range | sum(id) |
0-0.9 3
1-1.9 2
2-2.9 1
Ideally the visualization would be a bar chart, where I can adjust the range width interactively.
On Tableau click the value and then create-> bins
I have created a chart using YUI and want to display axis labels. The x axis is fine, but the y axis label appears inside of the data.
Here is what is happening:
10 |
9 |
8 |
7 l |
6 a |
5 b | CHART
4 e |
3 l |
2 |
1 |
0 |_____________________________
Here is what I want to happen:
10 |
9 |
8 |
l 7 |
a 6 |
b 5 | CHART
e 4 |
l 3 |
2 |
1 |
0 |_____________________________
Here is my code for the chart axes:
var chartaxes = {
timeelapsed:{
position:"bottom",
type:"category",
title:"label"
},
kWh:{
position:"left",
type:"numeric",
title:"label",
}
};
Is there any way to fix this?
You need to set the series that is associated with the axes to display the title correctly using the keys variable.
var chartaxes = {
timeelapsed:{
position:"bottom",
type:"category",
title:"Time Elapsed (minutes)",
keys: ["category"],
and so on.
I am trying to identify if a value is repeated sequentially in a vector N times. The challenge I am facing is that it could be repeated sequentially N times several times within the vector. The purpose is to determine how many times in a row certain values fall above the mean value. For example:
>> return_deltas
return_deltas =
7.49828129642663
11.5098198572327
15.1776644881294
11.256677995536
6.22315734182976
8.75582103474613
21.0488849115947
26.132605745393
27.0507649089989
...
(I only printed a few values for example but the vector is large.)
>> mean(return_deltas)
ans =
10.50007490258002
>> sum(return_deltas > mean(return_deltas))
ans =
50
So there are 50 instances of a value in return_deltas being greater than the mean of return_deltas.
I need to identify the number of times, sequentially, the value in return_deltas is greater than its mean 3 times in a row. In other words, if the values in return_deltas are greater than its mean 3 times in a row, that is one instance.
For example:
---------------------------------------------------------------------
| `return_delta` value | mean | greater or less | sequence |
|--------------------------------------------------------------------
| 7.49828129642663 |10.500074902 | LT | 1 |
| 11.5098198572327 |10.500074902 | GT | 1 |
| 15.1776644881294 |10.500074902 | GT | 2 |
| 11.256677995536 |10.500074902 | GT | 3 * |
| 6.22315734182976 |10.500074902 | LT | 1 |
| 8.75582103474613 |10.500074902 | LT | 2 |
| 21.0488849115947 |10.500074902 | GT | 1 |
| 26.132605745393 |10.500074902 | GT | 2 |
| 27.0507649089989 |10.500074902 | GT | 3 * |
---------------------------------------------------------------------
The star represents a successful sequence of 3 in a row. The result of this set would be two because there were two occasions where the value was greater than the mean 3 times in a row.
What I am thinking is to create a new vector:
>> a = return_deltas > mean(return_deltas)
that of course contains ones where values in return_deltas is greater than the mean and using it to find how many times sequentially, the value in return_deltas is greater than its mean 3 times in a row. I am attempting to do this with a built in function (if there is one, I have not discovered it) or at least avoiding loops.
Any thoughts on how I might approach?
With a little work, this snippet finds the starting index of every run of numbers:
[0 find(diff(v) ~= 0)] + 1
An Example:
>> v = [3 3 3 4 4 4 1 2 9 9 9 9 9]; # vector of integers
>> run_starts = [0 find(diff(v) ~= 0)] + 1 # may be better to diff(v) < EPSILON, for floating-point
run_starts =
1 4 7 8 9
To find the length of each run
>> run_lengths = [diff(run_starts), length(v) - run_starts(end) + 1]
This variables then makes it easy to query which runs were above a certain number
>> find(run_lengths >= 4)
ans =
5
>> find(run_lengths >= 2)
ans =
1 2 5
This tells us that the only run of at least four integers in a row was run #5.
However, there were three runs that were at least two integers in a row, specifically runs #1, #2, and #5.
You can reference where each run starts from the run_starts variable.
I am creating an iphone app where I have a grid view of 25 images as:
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
Now when any 5 consecutive images are selected it should say bingo, like if 0,6, 12, 18, 24 are selected it should say Bingo.
How will i do that, please help me.
Many Thanks for your help.
Rs
iPhone Developer
-----------------------------------
| 0 | 1 | 2 | 3 | 4 | 5 |
-----------------------------------
| 6 | 7 | 8 | 9 | 10 | 11 |
-----------------------------------
| 12 | 13 | 14 | 15 | 16 | 17 |
-----------------------------------
| 18 | 19 | 20 | 21 | 22 | 23 |
-----------------------------------
| 24 |
-----------------------------------
Hope this is how your grid looks like.
Associate each column with an array. The array will contain the list of all neighbour elements of that column,
For example, the neighbor array of the column [ 6 ] will ollk like array(0, 7, 12), which are all the immediate neighbors of [ 6 ].
Set counter = 0;
Now, when someone clicks an element, increment the counter (Now counter = 1)
When he clicks the second element, check if the element is in the neighbor list of the previous element OR the 1st element.
If the element clicked is in the neighbor list, increment the counter (now counter = 2)
ELSE
If the element clicked is not in the neighbor array, reset the counter (counter = 0) and start over.
Check if the value of counter = 5. If it is, Say Bingo!
The algorithm is not fully correct, but I hope you got the idea :)