|
From: Ethan M. <merritt@u.washington.edu> - 2006-06-12 18:08:08
|
On Monday 12 June 2006 02:11 am, Niklas Elmqvist wrote: > I am looking to create a parallel coordinate plot for a paper I am > working on. I was not familiar with this plot type, so I did some Googling. Is this an adequate description of what you want? http://www.agocg.ac.uk/reports/visual/casestud/brunsdon/parallel.htm > I've started looking at using gnuplot for this purpose, but there > appears to be no PC plot type Correct, there is no such plot type in gnuplot. It does look quite interesting, however, so I encourage you to submit it as a "Feature Request" on gnuplot's SourceForge site. > Any ideas on how to achieve this? Using gnuplot or some other (freely > available) tool? I think it would not be very hard to tweak your input data file so that gnuplot can produce a reasonable approximation of what you want. If if understand correctly (which I may not) then your data consists of a set of observations, each of which contains 5-10 associated values: # Obs #Val_1 #Val_2 #Val_3 ... #Val_10 ############################################### 1 val1 - val3 val10 2 val1 val2 val3 val10 3 val1 val2 val3 - 4 - val2 val3 val10 ... I have marked missing values with a '-' character. You want to plot this so that there is a line on the graph for each observation, and that line passes through val1 at x=1, val2 at x=2, and so on. I hope I got that correctly. The first issue is that gnuplot normally uses the x-axis to separate the *row* entries rather than the *column* entries. So you probably will have to transpose the rows and columns of your input data file, so that now it looks like this: Dim Obs1 Obs2 Obs3 ... Obs100 ############################################## Val_1 val1 val1 val1 val1 Val_2 - val2 val2 val2 Val_3 val3 val3 val3 val3 At this point it is relatively simple to plot in gnuplot. I will use auto-labelling commands from version 4.1, but you could get the same plot in earlier versions by placing the labels manually. Your plot commands would be something like set datafile missing '-' set key autotitle columnheader set key outside left set xrange [0.5:10.5] # Span the 10 dimensions set auto y # y will scale itself set style data line # plot with lines, no points # (lt -1) is thin black line plot "datafile" using xticlabel(1):2 lt -1, \ "" using 3 lt -1, \ "" using 4 lt -1, \ "" using 5 lt -1, \ ... "" using 100 lt -1 The vertical bars can be added manually: set arrow 1 from 1, graph 0 to 1, graph 1 nohead set arrow 2 from 2, graph 0 to 2, graph 2 nohead ... set arrow 10 from 10, graph 0 to 10, graph 10 nohead If you have a scaling function for a particular dimension, it can be defined and added as follows: # Normalization function for dimension 2 f_2(g) = (g - GMIN) / (GMAX-GMIN) input_2(g) = ($0 == 3) ? f_2(g) : g plot "datafile" using xticlabel(1):(input_2($2)), \ "" using (input_2($3)), \ ... > (Sorry if this is an obvious question, but I have cast around a bit > and I did not find an obvious answer.) Not so obvious, but quite possible. I am intrigued by the plot mode, and will seriously consider adding it as a supported plot type. It is similar in many ways to the stacked histogram plot modes, so a model already exists for its implementation in gnuplot. -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle WA |