带有主网格线和次网格线的等高线图
您可以通过拆分数据并创建两个重叠的等高线图来创建突出所选等高线的等高线图。
例如,创建 peaks
函数的等高线图,其中偶数编号的等高线为实线,奇数编号的等高线为虚线。为偶数编号的水平绘制一个等高线。然后,在其上覆盖以虚线为奇数编号的水平绘制的第二个等高线图。
major = -6:2:8; minor = -5:2:7; [cmajor,hmajor] = contour(peaks,'LevelList',major); clabel(cmajor,hmajor) hold on [cminor,hminor] = contour(peaks,'LevelList',minor); hminor.LineStyle = ':'; hold off