FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Several hatching improvements by QuLogic · Pull Request #7421 · matplotlib/matplotlib · GitHub

Repository navigation

Several hatching improvements - #7421

Merged
NelleV merged 5 commits into
matplotlib:v2.xfrom
QuLogic:hatch-dpi-density
Nov 14, 2016
Merged

NelleV merged 5 commits into
matplotlib:v2.xfrom
QuLogic:hatch-dpi-density

Conversation

QuLogic commented Nov 7, 2016 •
edited
Loading

Copy link
Copy Markdown
Member

This produces some more consistency for hatches across multiple backends.

QuLogic added this to the 2.0 (style change major release) milestone Nov 7, 2016

Copy link
Copy Markdown
Member

Would be good if @mdboom could look at this, but 👍

Holding off on merging this until @QuLogic has looked at the hatch origin issue seems reasonable to me to avoid having to re-generate the test images again.

The hatch buffer was created at 72 pixels, with the assumption that that
is the "unit square" (1in*1in). However, with default DPI increased to
100, that buffer is actually too small, causing hatching to be denser
than it should be. On test images where the DPI was set really low, the
hatching was less dense than it should be.

Fixes matplotlib#4108.
Doesn't change anything; just makes it consistent with what it actually
is.

Also, remove comment about DPI-dependence, because hatching should not
be DPI dependent.
Also, clean up some redundancies; 72 -> sidelen and the setpattern
operator simplifies setting the pattern.
Agg uses top-left as origin, while PDF/PS use bottom-left. A vertical
shift by the page height fixes that.

See example in matplotlib#4108.
This matches behaviour with the Agg backend.

Fixes matplotlib#3023.
Fixes matplotlib#6228.
QuLogic changed the title [WIP] Generate rasterized hatching at correct DPI. [MRG] Several hatching improvements Nov 9, 2016

QuLogic commented Nov 9, 2016 •
edited
Loading

Copy link
Copy Markdown
Member Author

I've fixed the hatching origin in the PDF and PS backends, and also made a few other improvements in the PS backend. See the description for an updated explanation.

Note, a lot of the PS and PDF backends don't really seem to be tested... Could add the test based on the related issues, but not sure where the best place is.

tacaswell changed the title [MRG] Several hatching improvements [MRG+1] Several hatching improvements Nov 9, 2016
NelleV added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Nov 10, 2016
NelleV merged commit 571d7ef into matplotlib:v2.x Nov 14, 2016
QuLogic deleted the hatch-dpi-density branch November 14, 2016 21:50
QuLogic changed the title [MRG+1] Several hatching improvements Several hatching improvements Nov 14, 2016

NelleV commented Nov 14, 2016

Copy link
Copy Markdown
Member

Thanks for the patch!

Copy link
Copy Markdown

How can I set the hatch line color when using fill_between? I am only able to set the background color using the color kwarg. edgecolor doesn't appear to do anything...

Copy link
Copy Markdown
Member

@jkokorian sorry meant #7976

Copy link
Copy Markdown

thanks!

andres0l1 commented Apr 3, 2017 •
edited
Loading

Copy link
Copy Markdown

Hi, Sorry I am a bit new to Python but I am having the same problems as in: #3023 I have re-installed Matplotlib and updated it but my hatches still do not show up when I save my plot as .pdf
Thanks!

Copy link
Copy Markdown
Member

@andres0l1 Can you please open a new issue with a minimal example of what is not working for you?

Copy link
Copy Markdown

Sure I will!

self._convert_path(Path.hatch(hatch), Affine2D().scale(sidelen),
simplify=False))
self._pswriter.write("""\
fill

mkvoya Jan 2, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Anyone knows whether it is okay to write "fill" here? I deleted the "fill" and the hatch works on v3.0.2. The issue is described in #8289.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Or shell we use the shfill command?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What is the difference between fill and shfill?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@tacaswell sorry, I just skimmed the spec of EPS and found that shfill (shading fill, which "paints the shape and color shading described by a shading dictionary, subject to the current clipping path") seems not related.

But I do have tried multiple manual fixes on the generated eps file and had the following findings:

  1. Simply removing the "fill" can solve the issue in Hatching in EPS figures doesn't show up in Preview on MacOS X with Matplotlib 2.0 #8289. But when we draw with "*", the stars are not filled with colors, which breaks Rasterizing patch changes filling of hatches in pdf backend #6228.
  2. Surrounding the fill with gsave and grestore, also fixes Hatching in EPS figures doesn't show up in Preview on MacOS X with Matplotlib 2.0 #8289, but the result of Rasterizing patch changes filling of hatches in pdf backend #6228 is as follow.

I'm not familiar with the eps format, but hope the information is helpful.

mkvoya mentioned this pull request Aug 16, 2019
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend: agg backend: pdf backend: ps Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL