# Background image with specific coordinates in Plots.jl

**URL:** <https://discourse.julialang.org/t/background-image-with-specific-coordinates-in-plots-jl/82905>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [June 17, 2022, 8:27am UTC](https://discourse.julialang.org/t/background-image-with-specific-coordinates-in-plots-jl/82905 "2022-06-17T08:27:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/unis/32/19458_2.png) [@unis](https://discourse.julialang.org/u/unis)\
**Post date:** [June 17, 2022, 8:27am UTC](https://discourse.julialang.org/t/background-image-with-specific-coordinates-in-plots-jl/82905/1 "2022-06-17T08:27:27Z")

</div>

How can a background image be added at specific coordinates (and with a specific scale) on a Plots.jl plot?

Assume you have an image of a floor plan whose corner points are associated with specific coordinates, and you’d like to draw additional objects on top.

I can specify the limits of a plot (fitting the domain of the floor plan), and I can draw additional geometries.

```julia
using Plots
using FileIO

bg_img = load("floorplan.jpg")

p = plot(bg_img, xlim=(-1,2), ylim=(-3,4))

plot!(p, [-1,2], [-3,4], color="red")

savefig(p, "floorplan_with_geometries.png")                   

```

How can I instruct Plots.jl to scale the background image as desired (such that its corner points coincide with the axis limits)?

Many thanks in advance.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [June 17, 2022, 12:08pm UTC](https://discourse.julialang.org/t/background-image-with-specific-coordinates-in-plots-jl/82905/2 "2022-06-17T12:08:03Z")

</div>

You could do something like:

```julia
sz = size(bg_img)
x, y = LinRange(-1, 2, sz[1]), LinRange(-3, 4, sz[2])
plot(x, y, bg_img)

```
