# Changing the values of axes without resizing the image/figure in Plots.jl

**URL:** <https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702>\
**Category:** General Usage\
**Created:** [October 3, 2020, 6:42pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702 "2020-10-03T18:42:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![libensvivit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libensvivit/32/19006_2.png) [@libensvivit](https://discourse.julialang.org/u/libensvivit)\
**Post date:** [October 3, 2020, 6:42pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702/1 "2020-10-03T18:42:46Z")

</div>

Hey,

I have an image of 300x300 pixels loaded in Plots and I’m having a hard time modifying the axes without altering the image. If I change the xlims, the image gets resized. If I try xticks, it gets weird if I pass 300. (My aim is to have very small numbers in the axes, without changing any size of it).

_xlims=(0,1000)_  
 ![problem](https://global.discourse-cdn.com/julialang/original/3X/1/4/1448204f93f5bab8a0e36217aa6b17083ffc478e.png)

[This guy](https://www.mathworks.com/matlabcentral/answers/80362-how-to-adjust-the-x-axes-and-y-axes-values-without-resizing-the-image-figure) had the same problem in MATLAB, and luckily someone got it fixed. Is there a similar trick to achieve the same thing in Julia?

---

<div class="post-metadata">

**Author:** ![danielw2904](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielw2904/32/10890_2.png) [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Post date:** [October 3, 2020, 7:31pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702/2 "2020-10-03T19:31:26Z")

</div>

Could you post your code so far?  
Have you tried setting `size=(a, b)` as a kwarg to `plot`?

---

<div class="post-metadata">

**Author:** ![libensvivit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libensvivit/32/19006_2.png) [@libensvivit](https://discourse.julialang.org/u/libensvivit)\
**Post date:** [October 3, 2020, 7:55pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702/3 "2020-10-03T19:55:24Z")

</div>

@danielw2904 size you mentioned also changes the size of the image, fonts become smaller and don’t give the expected results.

After loading the image:

`img = Images.load("path/to/image.jpg") # 300x300 pixels`

I tried the following combinations seperately.  
`plot(img, ylims=(0, 1000), xlims=(0, 1000));`  
`plot(img, yticks=0:100:1000, xticks=0:100:1000);`  
`plot(img, size=(1000,1000), yticks=0:100:1000, xticks=0:100:1000)`

No luck so far. Also, I found that PyPlot.jl has similar adjustments with axes i.e `ax = gca()`, but it calls Python library and that is something I’m trying to avoid.

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [October 3, 2020, 9:34pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702/4 "2020-10-03T21:34:14Z")

</div>

You should pass `x` and `y` coordinates to `plot`, e.g.,

```julia
x = range(0,1000,length=size(img,1))
y = range(0,1000,length=size(img,2))
plot(x,y,img)

```

---

<div class="post-metadata">

**Author:** ![libensvivit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libensvivit/32/19006_2.png) [@libensvivit](https://discourse.julialang.org/u/libensvivit)\
**Post date:** [October 3, 2020, 9:53pm UTC](https://discourse.julialang.org/t/changing-the-values-of-axes-without-resizing-the-image-figure-in-plots-jl/47702/5 "2020-10-03T21:53:20Z")

</div>

Yes!! This is what I really want. Thanks, sir!
