Image Analyst, the image below the text is what I get after running the additional code which you suggested. The 'grid on' function looks good. However, the x axis ticks do not match with my actual data values in the x array. Is it not possible to match the ticks just as it is with the x array data values from 0 to 1. I can imagine because of 0.05 as one of the data values in the x array the increment is not equally spaced but is there a way to keep all the data values in the x axis as it is. I have created the image on the top of the text by manually adding shades in excel cells with labels, not a very efficient way but still this is what I am trying to achieve via MATLAB or any other software. It seems I need to do a lot of editing in the Graphics editor window to get to the excel based visualization. Do you know if it is possible to emulate the excel based visualization in MATLAB without much manual edits?
How do I create a 2D plot which looks something like a matrix plot with an array of values in the horizontal axis (x) and multiple arrays of values in the vertical axis (y)?
6 views (last 30 days)
Show older comments
Following are my data values:
x =[0,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
y1=[0.02,0.02,0.02,0.01,0,0,0,0,0,0,0,0]
y2=[0,0.01,0.03,0.05,0.26,0.56,0.9,1,1,1,1,1]
y3=[0.02,0.03,0.17,0.72,1,1,1,1,1,1,1,1]
y4=[0.02,0.07,0.35,0.96,1,1,1,1,1,1,1,1]
y5=[0.02,0.23,0.71,1,1,1,1,1,1,1,1,1]
y6=[0.03,0.23,0.9,1,1,1,1,1,1,1,1,1]
y7=[0.03,0.45,0.99,1,1,1,1,1,1,1,1,1]
y8=[0,0.54,1,1,1,1,1,1,1,1,1,1]
y9=[0.03,0.76,1,1,1,1,1,1,1,1,1,1]
y10=[0.01,0.79,1,1,1,1,1,1,1,1,1,1]
I tried to first create a scatter plot with smooth lines but it does not seem to be the best way to visualize the data as repeated values like 1 overlap. Therefore I want to create a 2D matrix plot where all the values of y will be in shades of black and white, where white color would be assigned to data value 1 and black to data value 0 and all the other y values will have the intermediate shades. I am not sure how to do this in MATLAB. I tried to create these plots in Excel, IDL, Mathematica but I did not get what I am looking for. Kindly suggest if there is a way to create these plots.
Answers (2)
Image Analyst
on 26 Dec 2015
What about making it an image:
x =[0,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
y1=[0.02,0.02,0.02,0.01,0,0,0,0,0,0,0,0]
y2=[0,0.01,0.03,0.05,0.26,0.56,0.9,1,1,1,1,1]
y3=[0.02,0.03,0.17,0.72,1,1,1,1,1,1,1,1]
y4=[0.02,0.07,0.35,0.96,1,1,1,1,1,1,1,1]
y5=[0.02,0.23,0.71,1,1,1,1,1,1,1,1,1]
y6=[0.03,0.23,0.9,1,1,1,1,1,1,1,1,1]
y7=[0.03,0.45,0.99,1,1,1,1,1,1,1,1,1]
y8=[0,0.54,1,1,1,1,1,1,1,1,1,1]
y9=[0.03,0.76,1,1,1,1,1,1,1,1,1,1]
y10=[0.01,0.79,1,1,1,1,1,1,1,1,1,1]
theImage = [y1;y2;y3;y4;y5;y6;y7;y8;y9;y10]
imshow(theImage, [], 'InitialMagnification', 1600);
colorbar;
8 Comments
Image Analyst
on 26 Dec 2015
where each value is represented by a patch of that color or gray level. Or else use plot() or scatter() and then use paint or Photoshop or some photo editing package to mock up what you'd like to see, because I'm not visualizing what it might be.
0 Comments
See Also
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!