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

[ENH]: directional antialiasing filter #29711

Open
@anntzer

Description

@anntzer

Problem

Currently, the antialiasing filter used by imshow() is applied both in the x and the y direction. There are cases where "image-like" data is highly sampled in one direction (requiring antialiasing) but not in the other, and also has some nans; an example is a kymograph like subfigure 1c athttps://www.nature.com/articles/s41467-017-01462-y/figures/1

For such data, the current default interpolation settings (antialiased + rgba (becauseone of the directions is oversampled) can yield not nice artefacts, in particular at the boundary between "data" and "nan":

frompylabimport*vals=np.full((50,500),np.nan)fori,rowinenumerate(vals):n=200+np.random.randint(300)row[:n]=np.sin(np.arange(n)/10+i/5)# make some fake dataaxs=figure(layout="constrained",figsize=(10,10)).subplots(3,3,subplot_kw={"xticks": [],"yticks": []})fori,interpolationinenumerate([None,"none","antialiased"]):forj,stageinenumerate([None,"data","rgba"]):axs[i,j].text(0,0,f"{interpolation=},{stage=}",bbox={"fc":"w"})axs[i,j].imshow(vals.T,aspect="auto",origin="lower",interpolation=interpolation,interpolation_stage=stage)show()

Image

For this specific dataset, the best settings currently available is probably to go back to interpolation="data". But ideally, it would be nice if it was possible to have a separable antialiasing filter (I don't actually know if the current one is separable), so that one can apply it (here) only in the vertical direction (ideally in rgba space).

Proposed solution

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp