@@ -701,6 +701,7 @@ def __init__(self):
701701 self ._url = None
702702 self ._gid = None
703703 self ._snap = None
704+ self ._sketch = None
704705
705706 def copy_properties (self , gc ):
706707 'Copy properties from gc to self'
@@ -720,6 +721,7 @@ def copy_properties(self, gc):
720721 self ._url = gc ._url
721722 self ._gid = gc ._gid
722723 self ._snap = gc ._snap
724+ self ._sketch = gc ._sketch
723725
724726 def restore (self ):
725727 """
@@ -1003,6 +1005,53 @@ def get_hatch_path(self, density=6.0):
10031005 return None
10041006 return Path .hatch (self ._hatch , density )
10051007
1008+ def get_sketch_params (self ):
1009+ """
1010+ Returns the sketch parameters for the artist.
1011+
1012+ Returns
1013+ -------
1014+ sketch_params : tuple or `None`
1015+
1016+ A 3-tuple with the following elements:
1017+
1018+ * `scale`: The amplitude of the wiggle perpendicular to the
1019+ source line.
1020+
1021+ * `length`: The length of the wiggle along the line.
1022+
1023+ * `randomness`: The scale factor by which the length is
1024+ shrunken or expanded.
1025+
1026+ May return `None` if no sketch parameters were set.
1027+ """
1028+ return self ._sketch
1029+
1030+ def set_sketch_params (self , scale = None , length = None , randomness = None ):
1031+ """
1032+ Sets the the sketch parameters.
1033+
1034+ Parameters
1035+ ----------
1036+
1037+ scale : float, optional
1038+ The amplitude of the wiggle perpendicular to the source
1039+ line, in pixels. If scale is `None`, or not provided, no
1040+ sketch filter will be provided.
1041+
1042+ length : float, optional
1043+ The length of the wiggle along the line, in pixels
1044+ (default 128.0)
1045+
1046+ randomness : float, optional
1047+ The scale factor by which the length is shrunken or
1048+ expanded (default 16.0)
1049+ """
1050+ if scale is None :
1051+ self ._sketch = None
1052+ else :
1053+ self ._sketch = (scale , length or 128.0 , randomness or 16.0 )
1054+
10061055
10071056class TimerBase (object ):
10081057 '''
@@ -1937,7 +1986,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
19371986
19381987 *quality*: The image quality, on a scale from 1 (worst) to
19391988 95 (best). The default is 95, if not given in the
1940- matplotlibrc file in the savefig.jpeg_quality parameter.
1989+ matplotlibrc file in the savefig.jpeg_quality parameter.
19411990 Values above 95 should be avoided; 100 completely
19421991 disables the JPEG quantization stage.
19431992
@@ -1957,7 +2006,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
19572006 options = cbook .restrict_dict (kwargs , ['quality' , 'optimize' ,
19582007 'progressive' ])
19592008
1960- if 'quality' not in options :
2009+ if 'quality' not in options :
19612010 options ['quality' ] = rcParams ['savefig.jpeg_quality' ]
19622011
19632012 return image .save (filename_or_obj , format = 'jpeg' , ** options )
0 commit comments