# Fixing problems with my plot

**URL:** <https://discourse.julialang.org/t/fixing-problems-with-my-plot/47209>\
**Category:** New to Julia\
**Created:** [September 24, 2020, 2:07pm UTC](https://discourse.julialang.org/t/fixing-problems-with-my-plot/47209 "2020-09-24T14:07:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [September 24, 2020, 2:07pm UTC](https://discourse.julialang.org/t/fixing-problems-with-my-plot/47209/1 "2020-09-24T14:07:43Z")

</div>

Hello!

I have a plot which currently looks like:

![image](https://global.discourse-cdn.com/julialang/original/3X/d/3/d364f81ff42a030a17c72b4134a5ccdd8360b9eb.png)

There are something I would like to change about it, which I cannot figure out how to do:

- Make x and y axis “intersect”, so it does not say “0” twice
- Make it a “square plot”, such that the help grid becomes square too and not rectangular
- I want a black box around the plot

Something which looks a bit like what I want is (ignore the dashed horizontal lines):

![image](https://global.discourse-cdn.com/julialang/original/3X/3/a/3abc035ab665f8c0e1317a1069110cc79d16481f.png)

The code I am using to generate the first image currently is:

```julia
using Plots
using PGFPlotsX
using PlotThemes

pgfplotsx()

theme(:default,
      fglegend = colorant"#000000", #legend
      guidefontcolor = colorant"#000000",
      showaxis = true,
      formatter = :scientific,
      aspect_ratio = :equal, #:equal
      widen=true,
      ylims=(0,100),
      thickness_scaling = 1.25,
        )
plot(rand(100)*100)
plot!(rand(100)*100)
xlabel!("Moving Average Sample (it is not time anymore due to averaging)")
ylabel!(raw"E $\left[\frac{\text{J}}{\text{kg}}\right]$")

```

Would anyone happen to know how to achieve this? For example to get the “square shape” I tried using aspect\_ratio = :equal but apparently I misunderstood what it actually does etc.

Kind regards

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [September 24, 2020, 3:14pm UTC](https://discourse.julialang.org/t/fixing-problems-with-my-plot/47209/2 "2020-09-24T15:14:30Z")

</div>

```julia

julia> theme(:default,
             fglegend = colorant"#000000", #legend
             guidefontcolor = colorant"#000000",
             showaxis = true,
             formatter = :scientific,
             aspect_ratio = :equal, #:equal
             #widen=true,
             ylims=(0.001,100),xlims=(0,100),
             thickness_scaling = 1.25, 
             framestyle=:box,
             size=(300,300)
               )

```

The solution for the frame is `framestyle=:box`. The `size=()` option makes the plot squared (although if the limits of x and y are the same, this is not needed). To remove the 0 from the `y` axis you might change ylim to slightly more than 0:

![image](https://global.discourse-cdn.com/julialang/original/3X/9/f/9fd745f1444006172def6f05a3c933d538f8c49a.png)

> [@Ahmed\_Salih](#):
>
> aspect\_ratio = :equal

This means that similar intervals in both axis will have the same apparent length. If the limits have the same interval sizes in both axis, that will do the trick. What was missing in your case is setting the x limits to be (0,100) to get the square plot.
