How to show multiple Y axis on a Parallel Coordinates Plot

I am new to matlab and am using a parallel coordinates plot to visualize a 10 dimensional data set. However the standard parallel coords plot only shows one Y axis. I would like to be able show the axis for each of the 10 attributes so total 10 Y axis placed exactly on the X ticks. I am wondering if this requires copying the existing Y axis . Any guidance would be much appreciated

 Réponse acceptée

It's not totally clear to me what exactly you want, visualizing 10-D data sounds impossible to me. Maybe you should post a minimal example of what your data would look like.
Here's a guess: you have a Nx10 matrix, and you want the values of the i-th column displayed along the i-th y-axis. Then maybe subplot could help you:
M = randi(15,[15 10]) % Create some random data
for i=1:10 % for each column
subplot(1,10,i) % 1 axes down, 10 axes across, axis number i
plot(.5,M(:,i),'*k'); % plot your data in the center
set(gca,'XLim',[0 1],'XTick',[],'YGrid','on'); xlabel(i);
end
The last line with set makes the x-axis go from 0 to 1, so the data is in the center, then gets rid of all the X-Ticks and turns on the grid with constant y-values. Does that point you the right direction?

4 commentaires

Jonathan
Thank you for your prompt answer.i will go through your code and try it. Based on my limited knowledge I realize that subplot will create separate plots while I want all the variables on a single plot. Thats why I chose the parallel co-rordinates plot which can handle higher dimension data . please take a look at this link if you have the time. http://eagereyes.org/techniques/parallel-coordinates I want to create exactly this graph with my data and show the axis values for each variable. the graph itself can be created easily in matlab , Its the axis that dont show up apart from a single Y axis on the left. i want to show the different axis values for each variable
I hope this might give you more insight and you can provide me some more advice if possible
thank you again
Ah, I see! That is pretty need, I hadn't heard of parallel coordinates yet. So I'm guessing you don't have access to the Statistics Toolbox, since otherwise you'd hopefully found the function parallelcoords. (EDIT: I see you mentioned the function and its shortcomings in your original post)
Is there a particular reason you want to use Matlab for this? I'm just asking since in the blog post you recommended the guy names some software that does it, and while you can relatively easy mimic the look in Matlab, the interactivity would involve quite some work. That said, here's my suggestion to recreate at least somewhat what you want:
%%Create some data with m observations, n dim's
m = 15; n = 10;
M = randi(15,[m n]);
%%Figure out the lower bounds and ranges of the data...
Rgs = [max(M,[],1); min(M,[],1)];
nrm = Rgs(1,:)-Rgs(2,:);
shft = Rgs(2,:);
%%...so you can normalize them to [0 1]
Mnrm = (M - ones(m,1)*shft)./ (ones(m,1)*nrm);
%%Now plot the data, one line per row
figure(1);
plot(1:n, Mnrm, 'b');
axis off; % switch off the axes
%%Because we're going to draw our own
for i=1:n
% A line for every column
line([i i],[0 1],'LineStyle','--','Color','k')
% Show the lower and upper end of the respective y-axis
text(i,-.05,num2str(Rgs(2,i)));
text(i,1.04,num2str(Rgs(1,i)));
end
%%Make the figure canvas white
set(gcf,'Color','w')
That leaves you a lot of ways of tweaking the look of the parallel coordinates plot. If you want actual y-axes, with ticks on them, then you probably will have to create ticks using the line command, labels using the text command. For individual cases you can probably do most of that using the GUI.
Let me know if there are new questions arising from this reply.
Jonathan
this is great!. thank you .This will defintely take me quite far with what I am trying to do. So then I guess there is no easy way copy the axis multiple times in the parallel coords plot function in Matlab?
the reason why i chose matlab is because the graph is basically going to be an interface to an underlying data mining classifier (decision tree) . I dont think there are many software packages that can handle both visualization and data mining so flexibly.
Ultimately i want to build a GUI that will have a parallel coords plot as a visual interface that will have individual slider controls for each axis so you can slide the values up and down etc. Anyway its a bit of a tall order for me since its only been a month since I started using matlab but i think I am getting there and with helpful people like you i think i will get it done
I will share with you more updates as i progress
thank you
ronny
Actually
Good, I'm glad it goes in the right direction. Afaik, there is no way of just copying the axes, you could only create new ones, what subplot is doing, but then you cannot connect the points in different axes to lines, so that's out.
You might want to look around the File Exchange http://www.mathworks.com/matlabcentral/fileexchange/, where there are quite a lot of nifty tools to tweak plots and so on.
Good luck and report back when you need additional help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by