version (3.71 KB) by Jos (10584)
Plot horizontal / vertical grid reference lines


Updated Mon, 11 Dec 2017 07:43:41 +0000

View License

GRIDXY(X) plots vertical grid lines at the positions specified by X. GRIDXY(X,Y) also plots horizontal grid lines at the positions specified by Y. GRIDXY(..., 'Prop1','Val1','Prop2','Val2', ...) uses the properties and values specified for color, linestyle, etc.
plot(10*rand(100,1), 10*rand(100,1),'bo') ; % random points
gridxy([1.1 3.2 4.5],'Color','r','Linestyle',':') ; % horizontal red dashed grid
h = gridxy([],[2.1:0.7:5 8],'Color',[0.9 1.0 0.2],'linewidth',3) ; % vertical solid thicker yellowish grid, and store the handle

GRIDXY can be used to plot a irregular grid on the axes.

Cite As

Jos (10584) (2022). GRIDXY (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!