1D plot with exciting colours
7 次查看(过去 30 天)
显示 更早的评论
Hi there,
I have quite a simple question, simple because I'm sure Matlab can do this easily, I just don't know how.
I want to plot some 1D data - in this case my data is a change in voltage over time. But instead of a plain line plot I want a plot where the space below the line is filled with colour. I don't really care what the colours correspond to, whether it is on a spectrum so that high voltage is coloured red and low is blue, or whether whole sections under high voltage peaks are coloured red (like a spectrogram) I would just like a visually appealing plot that uses some colour map; like this one:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149617/image.jpeg)
Although I understand that my data are no where near as detailed as this example.
Thanks for any help,
Rod.
EDIT:
As suggested, here are links to my data files...
2 个评论
Doug Hull
2013-9-6
This does not look like a 1-d plot to me, it looks like an image. What is the shape (vector, matrix, 3-d matrix) of the data you are trying to visualize?
采纳的回答
更多回答(1 个)
A Jenkins
2013-9-6
I am going to assume you have a 1d vector for time and a 1d vector for voltage. If not, then please answer Doug's comment above.
Otherwise, try this:
% provide 2 arrays for your time and voltage signals
xdata=1:0.1:10; %x axis data (array of time series)
zdata=1./xdata; %z axis data (array of voltage signals)
ydata=0:max(zdata)/100:max(zdata);
[xaxis,yaxis]=meshgrid(xdata,ydata);
zaxis=repmat(zdata,length(ydata),1);
x=reshape(xaxis,1,[]);
y=reshape(yaxis,1,[]);
z=reshape(zaxis,1,[]);
scatter3(x,y,(z>y),100,255*(z>y),'filled');
view(0,90);
14 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!