点集的渐变色
mathematica吧
全部回复
仅看楼主
level 1
以这个为例
ListPlot[Monitor[Table[{x, Sin[x]}, {x, 0, 2 Pi, 0.2}], x]]
比如想从红色渐变到蓝色,点集连线的渐变色我能弄出来,ListLinePlot,再加上ColorFunction -> {Blend[{Red, Blue}, # 1] &},但是对于点集ListPlot的渐变色就不行了。
应该怎么弄?谢谢!!
2019年10月19日 04点10分 1
吧务
level 12
Graphics[Table[{Blend[{Red, Blue}, x/(2 \[Pi])],
Point[{x, Sin[x]}]}, {x, 0, 2 Pi, 0.2}], Axes -> True,
AspectRatio -> 1/GoldenRatio]
2019年10月19日 09点10分 2
大佬nb,一下就给我解决了
2025年03月06日 03点03分
我举的例子不太好,因为一个函数的描点。如果对于一个纯粹的散点图,比如这个集合
2019年10月20日 09点10分
{{0., 0.}, {0.6, 0.564642}, {1.2, 0.932039}, {1.8, 0.973848}, {2.4, 0.675463}, {3., 0.14112}, {3.6, -0.44252}} 对于这个散点图的渐变色应该怎么画,谢谢 !!
2019年10月20日 09点10分
@阿斯青 结合知乎的jet函数自定义颜色 ,可以让颜色更加好看明显
2025年03月06日 03点03分
吧务
level 12
道理都是一样的,Table改成Map或Apply就行
pts = {{0., 0.}, {0.6, 0.564642}, {1.2, 0.932039}, {1.8,
0.973848}, {2.4, 0.675463}, {3., 0.14112}, {3.6, -0.44252}};
Graphics[Function[{x, y}, {Blend[{Red, Blue}, x/3.6],
Point[{x, y}]}] @璐村惂鐢ㄦ埛_053SRMK馃惥pts, Axes -> True,
AspectRatio -> 1/GoldenRatio]

Graphics[{Blend[{Red, Blue},
#[[1]]/3.6], Point[#
]} & /@ pts,
Axes -> True, AspectRatio -> 1/GoldenRatio]

Graphics[Table[{Blend[{Red, Blue}, pts[[i, 1]]/3.6],
Point[pts[[i]]]}, {i, 1, Length[pts]}], Axes -> True,
AspectRatio -> 1/GoldenRatio]
2019年10月20日 14点10分 3
谢谢大佬!这么耐心还给我提供了三种方案!!祝您工作顺利![哈哈][哈哈]
2019年10月21日 01点10分
吧务
level 15
LZ哪个版本?刚试了下版本12.2直接就能着色:
版本9倒是确实不可以。
顺便 ColorFunction -> {Blend[{Red, Blue}, #1] &} 这语法在版本12.2不可以( ListLinePlot 和 ListPlot 都不可以),但在版本 9 可以,是语法改了还是 bug 不清楚。
2021年02月06日 03点02分 5
谢谢吧主[真棒][真棒]回去学习一下
2021年02月06日 08点02分
1