简体   繁体   中英

Modifying label and tick on color bar of Plots.jl plot

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.

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")

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM