Skip to content

configure hash density and size #7750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
godaygo opened this issue Jan 5, 2017 · 12 comments
Closed

configure hash density and size #7750

godaygo opened this issue Jan 5, 2017 · 12 comments
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: hatch

Comments

@godaygo
Copy link

godaygo commented Jan 5, 2017

I've a laptop with HiDPI display, so I use c.InlineBackend.figure_format = 'retina' in IPython to prevent blurring in browser . I found some differences between mpl 1.5.3 and 2.0.0. I've tried to summarize them:

  • In both versions, blur disappears when I set up figure_format = 'retina'.

In mpl 1.5.3 'retina' also affects the hatches appearance (and they look nicer):

mpl 1 5 3 default title

mpl 1 5 3 retina title

Here you can't see the blur, but it actually is, without setting up 'retina' or 'png2x'.

In mpl 2.0.0 'retina' only affects blur effect:

mpl 2 default title

mpl 2 retina title

Also you can see that actual sizes differ between versions, I use 'Save image as' to get pictures. It's nice that visual size in 2.0.0 in Jupyter notebook holds the same, but hatches looks ugly:) Is it desirable behavior in 2.0.0?

%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patches

fig = plt.figure()
ax = fig.add_subplot(111, aspect='equal')

patt = ['-', '+', 'x', 'o', 'O', '.', '*', '\\', '/'] 

pol = lambda x, i: patches.RegularPolygon((i/(len(patt)-1), 0.5),
                                          50, 0.05, fill=False, hatch=x)

for i, pat in enumerate(patt):
    ax.add_patch(pol(pat, i))
    
ax.set_title('{} - retina\n size: ({}, {})'.format(mpl.__version__, fig.get_size_inches()[0],
                                                 fig.get_size_inches()[1]))
    
plt.show()

I use:
Python 3.6
IPython 5.1.0
jupyter-notebook 4.3.1
Firefox 50.1.0
Windows 10

EDIT:
mpl 2.0.0:
mpl 2 0 0

mpl 1.5.3:
mpl 1 5 3

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Jan 5, 2017
@tacaswell
Copy link
Member

att @Carreau As this is mostly with the inline backend someone from jupyter should be looped in.

@tacaswell
Copy link
Member

Hatches being dpi independent is a feature of 2.0.

@godaygo
Copy link
Author

godaygo commented Jan 5, 2017

@tacaswell Thank you let it be dpi independent.:) But the sizes really differ, I add print-screens in the same scale to my question, and OS is Windows. :)

@Carreau
Copy link
Contributor

Carreau commented Jan 6, 2017

Thanks, I"ll have a look

@tacaswell
Copy link
Member

ok, I can reproduce the issue locally. One possible solution is to use

patt = [p*2 for p in ['-', '+', 'x', 'o', 'O', '.', '*', '\\', '/'] ]

to increase the density of the hatch.

The default density looks like it has gone down (but should now be consistent across backends and dpi, see #7421 and http://matplotlib.org/2.0.0rc2/users/dflt_style_changes.html#hatching).

A feature that we probably need to add is an rcParam to change the default density.

@tacaswell
Copy link
Member

attn @QuLogic where is the hatch density set?

@tacaswell tacaswell modified the milestones: 2.2 (next next feature release), 2.0 (style change major release) Jan 16, 2017
@tacaswell
Copy link
Member

Pushing this to 2.2 because it requires adding configuration knobs to tune the hash size and density.

@tacaswell tacaswell changed the title figure_format = 'retina' behavior mpl 1.5.3 vs mpl 2.0.0. configure hash density and size Jan 16, 2017
@Carreau
Copy link
Contributor

Carreau commented Jan 16, 2017

Thanks @tacaswell, it's a good decision. I know it's tough to push things to later, but happy to see MPL 2.0 to be that close !

@QuLogic
Copy link
Member

QuLogic commented Jan 20, 2017

@tacaswell The density is applied in hatch.py from some default somewhere and a count of the number of specifiers used.

There are a lot of functions/methods that set a default value, but ultimately, the density is probably set from path.py:Path.hatch. This static method is directly called by the PDF and PS backends without a density, so it uses its default. The Agg backend uses backend_bases.py:get_hatch_path, but it doesn't pass a density either and uses the same default.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 5, 2023
@oscargus
Copy link
Member

oscargus commented Apr 5, 2023

Related to #20690

@github-actions github-actions bot removed the status: inactive Marked by the “Stale” Github Action label Apr 6, 2023
Copy link

github-actions bot commented Apr 8, 2024

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 8, 2024
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label May 9, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: hatch
Projects
None yet
Development

No branches or pull requests

5 participants