我想在matlab中绘制图表,在手中,我有两个从市场获得的原始数据,比如0.25,0.5,0.75,1,2,3和4,产品A的相应值是[0.9998, 0.997,0.887,0.779,0.661,0.442,0.345]和B分别为[0.878,0.765,0.662,0.594,0.436,0.304,0.211]。当我使用
plot([0.25,0.5,0.75,1,2,3,4],[0.9998,0.997,0.887,0.779,0.661,0.442,0.345],'k+',[0.25,0.5,0.75,1,2,3,4],[0.878,0.765,0.662,0.594,0.436,0.304,0.211],'b*')
然而,生成的图表给出了4行。应该怎么做才能解决这个问题?
答案 0 :(得分:0)
您需要在修改XTick之前创建图形处理程序,使用以下
figure
ax = gca ;
plot([0.25,0.5,0.75,1,2,3,4],[0.9998,0.997,0.887,0.779,0.661,0.442,0.345],'k+',[0.25,0.5,0.75,1,2,3,4],[0.878,0.765,0.662,0.594,0.436,0.304,0.211],'b*')
ax.XTick = [0 0.25 0.5 0.75 1 2 3 4];