(注意:此问题的所有答案对于版本 10 之前的 Mathematica 版本均有效。对于版本 10 及更高版本,请参阅 https://mathematica.stackexchange.com/questions/54486/how-to-access-new-colour-schemes-in-version -10 和 https:// /mathematica.stackexchange.com/questions/54629/what-are-the-standard-colors-for-plots-in-mathematica-10。)
当使用绘图或Mathematica 中的 >ListPlot 命令,选择某些默认颜色。
出于某些报告中统一性的原因,我想将它们与 PlotStyle 选项一起使用。事实证明,我无法使用预定义的颜色名称重现默认颜色,尽管蓝色和紫色似乎在某种程度上很接近。
因此我的问题是:
<块引用>
如何选择 Mathematica 在绘图中与 PlotStyle 一起使用的标准颜色?
先感谢您。
很好的答案由belisarius和Sjoerd 从中我们可以得出结论:
<块引用>
Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle ->颜色数据[1, 4]]
将导致以第四个标准颜色(一些漂亮的绿色)绘制正弦。
(Note: All the answers to this question are valid for versions of Mathematica before version 10. For versions 10 and above, see https://mathematica.stackexchange.com/questions/54486/how-to-access-new-colour-schemes-in-version-10 and https://mathematica.stackexchange.com/questions/54629/what-are-the-standard-colors-for-plots-in-mathematica-10.)
When using the Plot or ListPlot command in Mathematica, certain default colors are chosen.
For reasons of uniformity within some report I would like to use them along with the PlotStyle option. It turned out that I cannot reproduce the default colors with the pre-defined color names, although blue and purple seem to be somehow close.
Hence my question:
How can I chose the standard colors used by Mathematica in plots along with PlotStyle?
Thank you in advance.
Nice answers were given by belisarius and Sjoerd from which we can conclude that
Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> ColorData[1, 4]]
will result in a sine plotted in the fourth standard color, some nice green.
发布评论
评论(3)
我知道这确实迟到了,但是用于生成
ColorData[1]< 中的第
n
颜色的表达式/code> 是:更新 根据下面 Alexey 的评论,您可以使用以下命令找到它:
I know this is really late to the game, but the expression used to generate the
n
th color inColorData[1]
is:Update Based on Alexey's comment below, you can find this using:
Plot 使用的颜色位于
ColorData[1]
中。比较
与 贝利萨留的颜色
它们是相同的,除了一个是
Hue
术语,另一个是RGBColor
术语The colors used by Plot are in
ColorData[1]
.Compare
with Belisarius' colors
They are the same, except one is terms of
Hue
and the other in terms orRGBColor
如果这样做:
您将获得前 10 个使用的色调。
或者这为您提供了一个随时可用的列表:
使用示例:
如果您更喜欢 RGB 色彩空间,您可以做:
**编辑 ** 与 Eli 的公式相比:
太棒了,Eli!
If you do:
You get the first 10 Hues used.
Or this gives you a ready to use list:
Usage sample:
If you prefer the RGB color space you may do:
**Edit ** Comparing with Eli's formula:
Great, Eli!