Skip to content

Hatch linewidth for pdf and ps backends (#235). - #1200

Closed
jcmdev0 wants to merge 2 commits into
matplotlib:masterfrom
jcmdev0:master
Closed

jcmdev0 wants to merge 2 commits into
matplotlib:masterfrom
jcmdev0:master

Conversation

@jcmdev0

@jcmdev0 jcmdev0 commented Sep 4, 2012

Copy link
Copy Markdown

I added a simple rc parameter (hatch.linewidth) that can be used to specify the width of lines in barchart/etc. hatch marks. This was previously submitted to the sourceforge bug tracking system about a year ago.

The hard-coded pdf default linewidth was 0.1pt, the hard-coded ps default was 0pt. The patch sets the default across the two as 0.1pt.

Trying to get the issue number in here as #235

@travisbot

Copy link
Copy Markdown

This pull request fails (merged 2ab206f into a7aaa83).

@pelson

pelson commented Sep 4, 2012

Copy link
Copy Markdown
Member

@mdboom: I we are going to merge this, we would probably want to use this value for the linewidth of the agg hatching too. From a quick scan, it looks like the value is currently hard-coded in _backend_agg.cpp at approx line 1225: hatch_path_stroke.width(1.0);.

@mdboom

mdboom commented Sep 4, 2012

Copy link
Copy Markdown
Member

The change should be implemented for SVG, Cairo and Mac OS-X backends as well.

@dmcdougall

Copy link
Copy Markdown
Member

Also, it would be useful to add a hatch.linewidth entry to the matplotlibrc.template file.

@jcmdev0

jcmdev0 commented Sep 6, 2012

Copy link
Copy Markdown
Author

@mdboom, @pelson: The hatch docs indicate "Hatching is supported in the PostScript, PDF, SVG and Agg backends only." If we want to locate more places it needs to be fixed that's cool, and we should probably change the hatch docs? I don't have a vested interest in pushing this patch through (I haven't used this feature for over a year, but it seemed like someone cared about it again, and questions seem to pop up). Any help along the way would be appreciated.

_backend_agg.cpp never touches the rcParams and only uses the artists' properties. If we want to fix this for Agg and the other backends that don't have access to rcParams, we'll need to add a parameter to the artists.

For most, the parameters are set_{linewidth,hatch,linestyle,...}. hatchlinewidth seems too verbose. Would hatchwidth be a better parameter? Then we can change the rcParam to hatch.hatchwidth.

This does, however, lead to the problem that some of the hatch patterns are globally defined for the backend (PS, PDF). Should we ignore the getters and setters for the artists and just force a _hatchwidth parameter into the artists?

This iceberg is getting awfully big under the water.

@pelson

pelson commented Jan 9, 2014

Copy link
Copy Markdown
Member

PR is a year old so I'm closing it. Please feel free to update and re-invigorate this PR and it can be re-opened.

Personally, I'm interested in expanding hatching functionality in the near future to be able to control linewidth and color. Depending on how it goes, I'd also be interested in implementing custom hatch bitmap support for the backends which can support such a thing. But that is the future - in the meantime, please feel free to bring this PR back up to scratch.

Cheers!

@pelson pelson closed this Jan 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants