4.0

4.0 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 6.26 KB File ID: #12121
image thumbnail

cgrid

by Andri M. Gretarsson

 

31 Aug 2006 (Updated 01 Sep 2006)

chose the color and style of grid lines in a figure

| Watch this File

File Information
Description

Creates a new set of axes containing the colored grid, immediately behind the current axes. To make the axes with the grid visible, the current axes are made transparent and the current axes grid is removed. If any colored grid axes are in use when this function is called, it first deletes these old grids, before adding new cgrid axes. That way figure children don't multiply.

SYNTAX
<gridaxishandle>=cgrid(<colorarg, stylearg, colorargy>)

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
01 Sep 2006 John D'Errico

A nice idea.

While I am the last person to want to disagree with a somehat nonstandard commenting practice, there are some useful standards. For example, the matlab function lookfor uses the H1 line in each function for its behavior.

The header line in cgrid is:
%------------------------------------------------------------------------------------

See Loren's blog for more discussion on commenting a fuction.

http://blogs.mathworks.com/loren/

My only other comment is on the use of arguments for linestyle, color, etc. I'd suggest that property/value pairs would be more logical here, to be consistent with the rest of matlab. An advantage of property/value pairs is that it is so much easier in the future to enhance your code, if one day you decide to add other features, perhaps line thickness or transparency, etc. You also do not need to worry about what order the arguments appear in.

05 Jun 2007 M. B.

Hi,

I tried cgrid, there is only on Problem. I used a filled contourplot, the grid is below and invisible. Hope you can fix it...
But its a realy nice Idea.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
annotation Andri M. Gretarsson 22 Oct 2008 08:36:28
customization Andri M. Gretarsson 22 Oct 2008 08:36:28
color Andri M. Gretarsson 22 Oct 2008 08:36:28
grid Andri M. Gretarsson 22 Oct 2008 08:36:28
background Andri M. Gretarsson 22 Oct 2008 08:36:28
graphics Andri M. Gretarsson 22 Oct 2008 08:36:28

Contact us at files@mathworks.com