Mathematica数据处理(12)--图例
来源:互联网 发布:如何看懂财务报表 知乎 编辑:程序博客网 时间:2024/06/06 02:18
这一篇文章我们来讲一下图例
这个也算是前面美化留下来的一点小尾巴
图例 有专门的函数 PlotLegends
先来看一下一个简单的例子
data = Table[f, {f, {Sin[x], Cos[x], Sin[x + .5]}}, {x, 0, 3 Pi, 0.1}];ListPlot[ data, PlotLegends -> {Style[#, Italic] & /@ {"Sin[x]", "Cos[x]", "Sin[x+0.5]"}} ]
得到下面的图
其实通过Placed可以将标签放在 上下左右 四个位置
ListPlot[ data, PlotLegends -> {Style[#, Italic] & /@ {"Sin[x]", "Cos[x]", "Sin[x+0.5]"}, Placed[{"Sin[x]", "Cos[x]", "Sin[x+0.5]"}, Top]} ]
就像下面的图这样
我们来看一个小例子
continents = CountryData["Continents"]
graphic = Graphics[ MapIndexed[ Tooltip[{ColorData[33, First[#2]], CountryData[#1, "SchematicPolygon"]}, #1] &, continents], ImageSize -> 500 ]
将每个大洲的用不同颜色标注出来
然后把图例也画出来
legend = Column@ MapIndexed[ Legended[ Graphics[{ColorData[33, First[#2]], Rectangle[]}, ImageSize -> 30], #1] &, continents ]
得到下面的图
最后我们把两张图和在一起就可以了
Legended[graphic, legend]
就好啦
以上就把美化大概都讲完了,以后再有会慢慢补充的
2016/8/18
以上,所有
0 0
- Mathematica数据处理(12)--图例
- Mathematica数据处理(2)
- Mathematica数据处理(3)
- Mathematica数据处理(4)
- Mathematica数据处理(5)--Plot
- Mathematica数据处理(11)--标签
- Mathematica数据处理(1)--安斯库母四重奏
- Mathematica数据处理(6)--散点图(上)
- Mathematica数据处理(7)--散点图(下)
- Mathematica数据处理(8)--美化(上)
- Mathematica数据处理(9)--美化(中)
- Mathematica数据处理(10)--美化(下)
- Mathematica数据处理(13)--显示坐标
- Mathematica
- Mathematica
- 图例
- 怎么用Mathematica研究12阶群?
- Mathematica 讲座
- Java NIO系列教程(十) Java NIO DatagramChannel
- 红黑树
- 从零开始,DIY一个jQuery(1)
- 为Tomcat配置Https
- webservice接口调用
- Mathematica数据处理(12)--图例
- JS获取样式 改变样式
- Binary
- Java NIO系列教程(十一) Pipe
- C++ 去掉字符串末尾或者首的字符
- android MVC MVP MVVM如何区分
- Windows下Redis安装
- Material Design动画:涟漪效果
- 浅谈项目管理