Skip to content

[BUG] ylims does not respect yflip=true #4903

@pearzt

Description

@pearzt

Details

I'm trying to "crop" a plotted image using xlims and ylims. Everything works as expected when using yflip=false, but with yflip=true (default), the image is cropped in the wrong side. Furthermore, the image is shifted relative to the plot's coordinate system (notice how the orange point seems to shift on the second plot).

using Plots
using FileIO, HTTP, ImageIO
bg_img2 = load(HTTP.URI("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/GoldenGateBridge-001.jpg/640px-GoldenGateBridge-001.jpg"));

plot(bg_img2)
scatter!([385], [315])

whole_image

plot(bg_img2,
	ylim=(100, 480),
	yflip=true
)
scatter!([385], [315])

ylim

It seems to me that yflip=true is not correnctly respected when specifying ylims.

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pythonplot x
plotlyjs x
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: v1.40.2
Backend version (]st -m <backend(s)>): GR v0.73.3
Output of versioninfo():

Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × 13th Gen Intel(R) Core(TM) i7-1355U
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions