1

I have a scatter plot generated using Plots.jl in Julia via Plots.scatter(x, y, marker_z = z). This results in a scatter plot of x and y, where points are colored according to the corresponding values in z. There is a vertical color bar to the right of the scatter plot that indicates what colors correspond to what values of z.

I would like to modify the vertical color bar but was not able to find any details on how best to do this. The specific tasks I am interested in are:

  1. I would like to add a label for the color bar.
  2. I would like to modify the ticks on the color bar.
Sam Polk
  • 73
  • 4

1 Answers1

4

Use colorbar_ticks and colorbar_title

using Plots
pyplot()
colorbar_ticks=(0:0.2:1.0, string.(round.(Int, (0:0.2:1.0) .* 100), "%"))
Plots.scatter(rand(10), rand(10), marker_z = rand(10), colorbar_ticks=colorbar_ticks,clim=(0,1), colorbar_title="My title")

enter image description here

Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62