朱莉娅:如何将散点图上的所有点都设为相同的RGBA颜色?

问题描述

我正在尝试创建一个简单的散点图,其中所有点都用靛蓝进行着色:

# AbsVMinus and AbsV are x and y respectively
scatter(AbsVMinusI,AbsV,title = "Color-magnitude diagram",seriescolor = RGBA(140,20,252,1),legend = false)

我以“颜色”文档部分为例编写了这一行。但是,出现以下错误:

ERROR: LoadError: ArgumentError: (140,1) are integers in the range 0-255,but integer inputs are encoded with the N0f8
  type,an 8-bit type representing 256 discrete values between 0 and 1.
  Consider dividing your input values by 255,for example: RGBA{N0f8}(140/255,20/255,252/255,1/255)
  Or use `reinterpret(N0f8,x)` if `x` is a `UInt8`.
  See the READMEs for FixedPointNumbers and ColorTypes for more information.

我尝试了错误建议,但得到以下提示:

ERROR: LoadError: UndefVarError: N0f8 not defined

我在这里想念什么?

解决方法

所有参数的范围都是从零到一。

要查看您的紫色,只需:

RGBA(140/255,20/255,252/255,1.0)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...