No BSD License  

Highlights from
grid2 - add a grid to 2D plots

3.0

3.0 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 662 Bytes File ID: #8758
image thumbnail

grid2 - add a grid to 2D plots

by Stefan Schuberth

 

19 Oct 2005 (Updated 21 Oct 2005)

This function adds a grid to a 2D plot which can be modified.

| Watch this File

File Information
Description

This function adds a grid to 2D plots. The grid contains out of lines which can be modified by linestyles and color information. This function expands the functionality of the normal grid implemented in MATLAB plots.

plot(rand(1,10));
set(gcf,'color',[1 1 1]);
grid2(gca,'color',[0.7 0.7 0.7],'linewidth',3);

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
20 Oct 2005 Duane Hanselman

The axes properties 'XColor' 'YColor' 'ZColor' and 'GridLineStyle' already provide this capability. In fact with these properties you can make the grid color different along the different dimensions.

Function is poorly written. Use the basic object line(...) for drawing these kinds of lines rather than the high level plot(...) function, then you don't have to look at NextPlot properties, etc. You can then easily set HandleVisibility to 'off' to hide the new grid.

25 Feb 2008 Helmut Schulz

It's a good idea to have a function that changes the grid color and style. Mathworks hasn't implemented this function for years. The grid is implemented as a single graphical object and a handle is returned. So after generating a grid it can be modified easyly.

Please login to add a comment or rating.
Updates
21 Oct 2005

Example added

Tag Activity for this File
Tag Applied By Date/Time
annotation Stefan Schuberth 22 Oct 2008 08:03:22
customization Stefan Schuberth 22 Oct 2008 08:03:22
grid plot Stefan Schuberth 22 Oct 2008 08:03:22
line styles Stefan Schuberth 22 Oct 2008 08:03:22
2d Stefan Schuberth 22 Oct 2008 08:03:22
plots Stefan Schuberth 22 Oct 2008 08:03:22
grids Stefan Schuberth 22 Oct 2008 08:03:22
graphics Stefan Schuberth 22 Oct 2008 08:03:22

Contact us at files@mathworks.com