Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update hatch.py#27337

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Arikad0 wants to merge1 commit intomatplotlib:mainfromArikad0:Temp1
Closed

Update hatch.py#27337

Arikad0 wants to merge1 commit intomatplotlib:mainfromArikad0:Temp1

Conversation

Arikad0
Copy link

@Arikad0Arikad0 commentedNov 16, 2023
edited
Loading

Dashed Hatch added /#27170

@melissawm
Copy link
Member

Hi@Arikad0 - can you address the current check failures? (check out above the Linting, Mypy and Tests failures)

Also, if this PR closes the issue you mentioned in the description, you can use one of the magic phrases such as "Closes #" so that GitHub understands to link the issue and PR. Thanks!

@rcomer
Copy link
Member

As it stands, the implementation here is identical to that for the vertical lines, so we have

importmatplotlib.pyplotaspltfig,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="_")plt.show()

test

I believe the reason the tests fail is because we now have two vertical lines on top of each other for the "+" hatching. E.g here are the result and diff images for the failing legend test:

hatching

hatching-failed-diff

@Arikad0 do you have thoughts on how to actually create the dashed pattern?

@Arikad0
Copy link
Author

I'm a bit lost on how to proceed on this issue. Do you have any idea that may help? Thanks in advance

@melissawm
Copy link
Member

Gentle ping - any reviewers available to take a look? Thanks!

@rcomer
Copy link
Member

rcomer commentedMar 3, 2024
edited
Loading

I wondered if we could use theShapes type of hatch with a very simple straight path for this and actually it seems to work well:

Defining the class as

classDashes(Shapes):size=0.35def__init__(self,hatch,density):self.num_rows= (hatch.count('_'))*densitypath=Path([[0,0], [1,0]], [Path.MOVETO,Path.LINETO])self.shape_vertices=path.verticesself.shape_codes=path.codessuper().__init__(hatch,density)

and adapting the example from#27146

importmatplotlib.pyplotaspltimportnumpyasnp# Datacols=10rows=4data= (np.reshape(np.arange(0,cols,1), (1,-1))**2+np.reshape(np.arange(0,rows), (-1,1))+np.random.random((rows,cols))*5)# Plotfig,ax=plt.subplots()x=range(data.shape[1])ax.stackplot(x,data,hatch=["_","__","___","____"])ax.set_xlim(0,9)ax.set_ylim(0,350)plt.show()

I have
image

Possibly there are better ways.

@ShivamPathak99
Copy link
Contributor

Is there any way to bypass theMatplotlibDeprecationWarning, in case of adding custom class (e.g. dashed).

def_validate_hatch_pattern(hatch):valid_hatch_patterns=set(r'_-+|/\xXoO.*')# Adding '_' Dashed pattern

After implementing above and menetioning it inhatch.pyi , still getting

MatplotlibDeprecationWarning: hatch must consist of a string of "*+-./OX\ox|" or None, but found the following invalid values "_". Passing invalid values is deprecated since 3.4 and will become an error in 3.9.

@jklymak
Copy link
Member

Did you search for that warning in the source code?

ShivamPathak99 reacted with thumbs up emoji

@ShivamPathak99
Copy link
Contributor

Did you search for that warning in the source code?

Thanks, it is working after a restart.

@ShivamPathak99ShivamPathak99 mentioned this pull requestApr 13, 2024
5 tasks
@rcomer
Copy link
Member

I am going to close this in favour of#28072.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@Arikad0@melissawm@rcomer@ShivamPathak99@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp