logo

How to Swap the Horizontal and Vertical Axes in Julia 📂Julia

How to Swap the Horizontal and Vertical Axes in Julia

Overview

This article introduces a method to swap the horizontal and vertical axes in Julia.

Code

By using permute = (:y, :x) as an argument in the plot function, you can change the order of the axes.

bar(name, height)

ive1.png

bar(name, height, permute = (:y, :x))

ive2.png

Full Code

using Plots

name = ["Gaeul", "Yujin", "Rei", "Wonyoung", "Liz", "Leeseo"]
height = [164, 173, 170, 173, 171, 165]
bar(name, height)
bar(name, height, permute = (:y, :x))

Environment

  • OS: Windows
  • Julia: v1.10.0