Code covered by the BSD License  

Highlights from
applyhatch_plusC

5.0

5.0 | 4 ratings Rate this file 81 Downloads (last 30 days) File Size: 4.2 KB File ID: #26797
image thumbnail

applyhatch_plusC

by

 

27 Feb 2010 (Updated )

Modification of APPLYHATCH_PLUS, allowing for color and variable thickness for hatch patterns.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

This is a modification of previously submitted APPLYHATCH_PLUS.
APPLYHATCH_PLUSC creates a bitmap version of the defined figure where colored elements are replaced with specified colored hatch patterns.
APPLYHATCH_PLUSC allows for the definition of colors for the hatch patterns. Color may be defined using char string or RGB values. Various examples are provided showing some possibilities of APPLYHATCH_PLUSC and MAKEHATCH_PLUS.
Note: This function is different from Brandon Levey's APPLYHATCH_PLUSCOLOR, which has slightly different functionality and syntax.

Acknowledgements

Hatched Fill Patterns Plus inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
MATLAB Search Path
/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
10 Dec 2014 Brian Katz

This correction has now been included in the recent update.

10 Dec 2014 Brett Walker

When you test the length, now on line 95, you use the length function which returns the number of elements in the longest dimension (eg. A = [2x3] then length(A) = 3) This will cause a patterncolor matrix with <3 colors (rows) to fail because length(patterns) <3 and length(patterncolor) = 3.

If you use size(patterncolors,1) instead of length(patterncolors) (in the condition on line 95) this problem will be removed as it only returns the number of elements in the first dimension.

03 Sep 2014 Brian Katz

I am sorry but I don't understand the proposed modification. It is necessary to have an equal number of entries in PATTERNS and PATTERNCOLORS, otherwise there would be too few/many combinations. The PATTERNCOLORS can be either a string array of color chars, or a 3 column RGB value. This cannot be more or less than 3 to be RGB.
If you have a specific example where there is a problem, please send it to me.

10 Jul 2014 Tymofii Tereshchenko  
09 Jul 2014 Brett Walker

I had to make an alteration to line 97 of applyhatch_plusC to handle a matrix with less than 3 rows for patterncolors.

96: [patterncolors_row patterncolors_col] = size(patterncolors);
97: if length(patterns) ~= patterncolors_row
98: error(...)
99: end

Do you think you could make this, or another appropriate alteration, to allow matrices with less than 3 rows.

30 Apr 2014 Brian Katz

applyhatch_plusC applies to the entire figure, subplots included, so I don't understand the question. You cannot, however, use different hatching rules for two subplots. But, if you assure that the original subplots do not have any colors in common, you should still be free to make the results be anything you want.

29 Apr 2014 Ricardo Roldán

Hey there,
anyway to use it with subplots?
cheers,
Ricardo

27 Feb 2014 Jea sik SHIN

good!

07 Mar 2010 Zuofeng

Nice tool!

Helped me a lot!

02 Mar 2010 Jveer  
Updates
21 Sep 2011

Now includes modified makehatch_plus to allow for variable thickness hatches

10 Dec 2014

Correction to account for situations with less than 3 colors, as noted by commentors.

Contact us