How to fill color among different plots in GUI?

1 view (last 30 days)
I have matrix of a single column with 'k' rows and another matrix of dimension 'm' by 'n'. Now i want to plot this matrix with single column matrix as reverse YDir. For exa plot of different columns w.r.t. depth(single column matrix). Now i want to fill area between all curves starting from y axis side and want to scale the x-axis from 0 to 1.
  3 Comments
Walter Roberson
Walter Roberson on 23 Jun 2015
Is there one entry in the column vector for each row in your second matrix? SO k and m are the same? If not then how are the k entries in the column vector to be related to the m entries in any one column of your m x n matrix?
For the x direction we can use
x = linspace(0, 1, n);
Brij Bhushan Singh
Brij Bhushan Singh on 23 Jun 2015
Edited: Geoff Hayes on 26 Jun 2015
yes k and m are same. my GUI command is
Depth=handles.Depth
c=handles.c
l=length(Depth)
for i=1:l
hold on
plot(c(:,i),Depth)
end
c is kXm and depth is kX1. Now please tell me how to give fill command in GUI and scale x-axis from zero to 1 in gui.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jun 2015
[m, n] = size(YourData);
x = linspace(0, 1, n);
plot(x, DepthVector, YourData.'); %transpose!
If that does what you want for the plotting then let us know and we can work on the filling.
  1 Comment
Brij Bhushan Singh
Brij Bhushan Singh on 27 Jun 2015
Edited: Geoff Hayes on 27 Jun 2015
sorry it didn't worked i am able to plot please tell me how to fill. The code i used is
Depth=handles.Depth
c=handles.c
l=length(Depth)
colorstring = 'kbgry';
figure; cla;
hold on
for i = 1:2
plot(c(:,i),Depth, 'Color', colorstring(i))
xlim([0 1])
set(gca,'YDir','reverse')
end

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 27 Jun 2015
I'm having trouble visualizing. Can you upload a picture of what you'd like to achieve?
And have you tried the area(), patch(), or fill() commands to fill areas/regions with colors? Can you just try to plot your data with area() with your top color first, and your bottom color last (so the bottom plot will overlap (cover up) underneath the first curve (if I'm visualization/guessing this correctly)?

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!