# Plot with three y-axes (, so one y-axis has to be double)

**URL:** <https://discourse.julialang.org/t/plot-with-three-y-axes-so-one-y-axis-has-to-be-double/58699>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [April 6, 2021, 4:17pm UTC](https://discourse.julialang.org/t/plot-with-three-y-axes-so-one-y-axis-has-to-be-double/58699 "2021-04-06T16:17:34Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![dadaforpeace](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dadaforpeace](https://discourse.julialang.org/u/dadaforpeace)\
**Post date:** [November 15, 2021, 4:01pm UTC](https://discourse.julialang.org/t/plot-with-three-y-axes-so-one-y-axis-has-to-be-double/58699/10 "2021-11-15T16:01:58Z")

</div>

I have the same problem but unfortunately GLMakie did not work for me. The data in addition to the Jupyter Notebook file can be found here: [https://datashare.mpcdf.mpg.de/s/uPOltmpkDjlZl4F](https://datashare.mpcdf.mpg.de/s/uPOltmpkDjlZl4F)

I am doing the following:

```julia
using Plots
using CSV
using DataFrames
using Colors

df_1 = DataFrame(CSV.File("Energy.csv"))
df_2 = DataFrame(CSV.File("Population.csv"))
df_3 = DataFrame(CSV.File("Ppm.csv"))

a=18
plot(df_2.Year,df_2[:,4],
    xlims=(1800,2021),
    label = "Population", 
    ylabel = "World Population",
    color=RGB(0.337, 0.631, 0.749),
    linewidth=3, 
    legend = :topleft, 
    grid = :off,
    size = (1600,800),
    left_margin = 10Plots.mm, 
    right_margin = 50Plots.mm, 
    xtickfontsize=a,
    ytickfontsize=a,
    xguidefontsize=a,
    yguidefontsize=a,
    legendfontsize=a)
p = twinx()
plot(p,df_3.Year,df_3[:,4],
    xlims=(1800,2021),
    label = "Global CO₂ atmospheric concentration", 
    ylabel = "Global CO₂ concentration in ppm",
    color =RGB(0.439, 0.368, 0.470),
    linewidth=3, 
    legend = :topright, 
    grid = :off,
    size = (1600, 800),
    left_margin = 10Plots.mm, 
    right_margin = 50Plots.mm, 
    xtickfontsize=a,
    ytickfontsize=a,
    xguidefontsize=a,
    yguidefontsize=a,
    legendfontsize=a)
p = twinx()
plot!(p,df_1.Year,df_1.sum,
    xlims=(1800,2021),
    label = "Energy Consumption", 
    ylabel = "World Primary Energy Consumption",
    color =RGB(0.949, 0.352, 0.219),
    linewidth=3, 
    legend = :left, 
    grid = :off,
    size = (1600, 800),
    left_margin = 10Plots.mm, 
    right_margin = 50Plots.mm, 
    xtickfontsize=a,
    ytickfontsize=a,
    xguidefontsize=a,
    yguidefontsize=a,
    legendfontsize=a)

```

The result is the following:

 ![Population-Energy-PPM](https://global.discourse-cdn.com/julialang/original/3X/f/b/fbbce9ec35d1d43b9fea84c4ec4c29f6a7a970b0.png)

What I would like to change:

- Move the Y-ticks + Y-label of ‘Energy’ to the right
- Color the Y-ticks + Y-label of each graph
- Put all legends to the :topleft in decending size order.

Please help me to make the plot pretty again

---

_[View the full topic](https://discourse.julialang.org/t/plot-with-three-y-axes-so-one-y-axis-has-to-be-double/58699)._
