radar plots
Hi, is there a template available for generating a grid of radar plots? If not, is the "coordinates with range" example the best place to start?
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on 06 Jan, 2016 01:30 PM
This example is probably as close as you're going to get, but I find it a tad confusing. It uses cleverly constructed offsets into a sawtooth wave which is an unnecessary complication for a beginner.
My advice is to just start feeding things into a coordinates node, feed that into a connect and colorize node, and see what happens. For a radar plot I assume you will want to feed a set of values, possibly from a CSV file (using the import CSV node), but you could generate a short list of values in any number of ways to test it out.
Once you have one radar plot the way you like it, it's fairly easy to put multiple plots into a grid. One way to get started is to feed your plot into a group node, feed that into a translate node, and then attach a grid node to the translate point of the translate node. Adjust rows, column, height, and width of the grid and see what happens.
If you get stuck, share your code and ask for help.
Have fun!
John
2 Posted by Alexander Gogl on 20 Nov, 2018 07:26 PM
Hi John,
I am trying to create a grid of radar plots where the data for the plots comes from a CSV file with 4 value columns and several rows. Creating a plot for just one row or selecting each row with a frame and slice node (animation) works like a charm but I am failing to group each radar plot and arranging it on a grid because the connect node connects the coordinates of all rows, therefore I end up with one single geometry.
I have tried to solve it by using subnetworks to draw each row of values separately but it didn't worked out. Can you please give me an advice?
3 Posted by Alexander Gogl on 20 Nov, 2018 08:39 PM
Okay, know I have figured it out. The reason why it didn't worked in the first place was because I have switched the range of the value ports of radar_plot network to list and not value.
Changing the port range was the moment when I've told myself: "Yes! Now you've understood how subnetworks work" :D
Final setup
The final setup consists of two subnetworks (1) radar_plot and (2) distance.
(2) Is inside (1) and calculates the length of the current value according to the max value of the corresponding column (e.g. reviews).
(1) Gets the length for each column of the current row (that's why the range has to be "value") and draws the radio graph with axis and circles. The translate node at the end is controlled from outside the subnetwork.
One thing that bothers me is the number of ports needed for subnetwork (1): 2 for each axis. So if I would like to draw a radar plot with 6 variables, that would need 15 ports (12 + 3 basic ports). Instead, I would prefer a setup where the number of radar plot variables would not result in having to set up more ports.
@John Is there any advice you can give me to achieve that?
Support Staff 4 Posted by john on 20 Nov, 2018 09:22 PM
Hi Alexander,
Revised radar chart attached.
The secret to problems like this is to think in terms of a function. Clarify in your mind what the input and output of that function should be. In this case you want to turn each row of your table into a radar chart. So you need a function that takes in one row at a time and spits out one chart at a time.
So once you normalize your values (which you did in your distance subnetworks) you need to put them back into table form instead of just combining them. In my example I just collapsed all of your distance nodes into a single normalize node which takes in a raw table and spits out a normalized table. (This subnetwork has the column names hardwired in, but you could easily generalize this using the keys node.)
Now all you have to do is make a subnetwork (radar) that takes in the normalized table one row at a time and spits out a radar chart for each row. It is then an easy matter to arrange those charts in a grid.
I gave both radar and normalize a max distance (or radius) parameter so that you can easily adjust the size of each radar plot (adjust the radius node to make them all grow or shink). Radar should also automatically adapt to plots with more than four dimensions. You can burrow inside Radar (inside the plot sub-subnetwork) to adjust the styling of the radar charts if you want.
Hope that helps! Please let me know.
Thanks,
John
Support Staff 5 Posted by john on 20 Nov, 2018 09:30 PM
Alexander,
Looks like you figured this out on your own as I was writing my reply. Yes, the subnetwork has to be set to list, not value. You have indeed proved that you figured out subnetworks!
As you said, your solution is still hardwired to require a separate port for each dimension. My approach gets around that problem and is totally general purpose. My radar network will turn one row into a radar chart regardless of how many columns that row has. And as I said, you could use the keys node to make the normalize subnetwork general purpose so that it could normalize any table you feed it, regardless of how many columns that table has.
Please study my solution and see if it answers your questions. And congratulations for solving the core challenge on your own!
John
6 Posted by Alexander Gogl on 20 Nov, 2018 10:58 PM
Hello John,
thank you very much for the detailed feedback! The setup you proposed is much clearer than mine :) I really like the idea of using a polygon node instead of a rotation one.
I have adapted your setup and am testing it with a dataset of 500 Airbnb listings. It looks interesting so far. Here is a detail of it.
Support Staff 7 Posted by john on 20 Nov, 2018 11:21 PM
Alexander,
Wow - looks great! Looks like an interesting data set.
500 is a lot of radar charts. But the nice thing about a NodeBox table is that you can easily filter it (minimum accommodations, price range, etc.) and then sort it on one or more dimensions to extract a top ten list before feeding the table into your radar subnetwork.
Thanks for sharing this problem. I enjoyed helping with it.
John