[英]How to Draw a 3D graph in Matlab for the Data shown below
I need to plot and view the data in 3D plane for the data shown below, where the fragment ion is on X axis, amino acid on Y axis and 'Number of Ions' for a particular fragment ion & Amino Acid on Z axis. 我需要在3D平面中绘制和查看以下所示数据的数据,其中碎片离子在X轴上,氨基酸在Y轴上,特定碎片离子的'离子数'在Z轴上。
Fragment Ion Amino Acid No of Ions
'b1' 'YY' 1
'b2' 'YF' 7
'b2' 'YE' 3
'b4' 'TV' 4
'b5' 'VS' 11
'b7' 'VK' 10
'b8' 'VL' 7
'b12' 'VK' 9
I hope I understood you right. 我希望我对你的理解正确。 I would do it like this:
我会这样做:
data=importdata('yourdatafile.txt')
fragmentIon=data.textdata(2:end,1)
aminoAcid=data.textdata(2:end,2)
noOfIons=data.data
X=1:length(fragmentIon)
Y=1:length(aminoAcid)
Z=noOfIons
XTickLabels=unique(fragmentIon)
YTickLabels=unique(aminoAcid)
XTicks=1:length(XTickLabels)
YTicks=1:length(YTickLabels)
for i=1:length(fragmentIon)
X(i)=find(strcmp(XTickLabels,fragmentIon{i}))
Y(i)=find(strcmp(YTickLabels,aminoAcid{i}))
end
figure
plot3(X,Y,Z,'x')
set(gca,'XTick',XTicks,'XTickLabel',XTickLabels,'YTick',YTicks,'YTickLabel',YTickLabels)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.