gnuplot - 如何为 gnuplot 箱形图使用调色板索引?
问题描述
我尝试将一些索引映射到已定义调色板的颜色。但是定义的调色板似乎没有被使用。
给定一个文件data.txt
:
11
22
33
44
gnuplot 命令:
set nokey
set grid
set style fill solid
set boxwidth 0.5
set yrange [0:]
set palette model RGB maxcolors 7
set palette defined (0 'dark-violet', 1 'skyblue', 2 'dark-yellow', 3 'dark-green', 4 'dark-red', 5 'coral', 6 'green', 7 'purple')
plot 'data.txt' using 0:1:(column(0)+1) with boxes linecolor variable
这与定义的调色板不匹配。如何让 gnuplot 使用此处定义的调色板以及索引和颜色名称?
解决方案
这是我想出的解决方案:
set nokey
set grid
set style fill solid
set yrange [0:]
set palette defined (0 'dark-violet', 1 'skyblue', 2 'dark-yellow', 3 'dark-green', 4 'dark-red', 5 'coral', 6 'green', 7 'purple')
set cbrange [0 : 7]
unset colorbox
plot 'data.txt' using 0:1:(0.5):(column(0)) with boxes linecolor palette
解决方案是在绘图行中添加框宽度(0.5)
并使用cbrange
and linecolor palette
:
推荐阅读
- prolog - 具体化 call_with_time_limit / call_with_inference_limit
- python - 使用 Pandas 数据框和 Matplotlib 生成平滑线
- excel - 一排单元格包含通过和失败需要一个公式来确定真正的通过或失败
- reactjs - bit-src 没有显示 react bootstrap 的风格
- google-apps-script - 如何使用公式从单元格中获取值?
- c# - 强制 nuget 忽略目标框架冲突的包
- python - python 3.7中的self和/是什么意思?
- typescript - 如何根据高阶函数的静态字符串值推断类型?
- python - 使用带有 SNS 和 EMR 客户端的 lambda 中的 boto3 来获取集群的详细信息并将其发送到邮件
- ios - 如何在 MKMapSnapshotter 上绘制 CLLocationCoordinate2Ds(在 mapView 打印图像上绘制)