在Mathematica中用不同的颜色着色特定点 [英] Coloring specific points with a different color in Mathematica

查看:1725
本文介绍了在Mathematica中用不同的颜色着色特定点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mathematica命令的输出

The output of the Mathematica command

ListPointPlot3D[
  Join @@ Table[{x, y, 0}, {x, -6, 6, 1}, {y, -6, 6, 1}], 
  PlotStyle -> PointSize[0.02]]

如下图所示。

>

我想用红色对点(0,0)和(1,2)进行着色。如何修改上面的命令为此?

I want to color the points (0,0) and (1,2) with the color red. How do I modify the above command for this?

推荐答案

一个非常简单直接的方法是:

A very simple and straightforward way would be:

list = Join @@ Table[{x, y, 0}, {x, -6, 6, 1}, {y, -6, 6, 1}];
pts = {{0, 0, 0}, {1, 2, 0}};

ListPointPlot3D[{Complement[list, pts], pts}, 
 PlotStyle -> PointSize[0.02]]

当然,我没有明确指定颜色,因为下一个默认颜色是红色。但是,如果你想指定你自己的,你可以修改它一点:

Of course, I left it without explicitly specifying colors because the next default color is red. However, if you want to specify your own, you can modify it a little more as:

ListPointPlot3D[{Complement[list, pts], pts}, 
 PlotStyle -> {{Green, #}, {Blue, #}} &@PointSize[0.02]]

这篇关于在Mathematica中用不同的颜色着色特定点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆