如何使用颜色条中的 z 值生成线性颜色图 (cplot) [英] How to generate the lineared color plot (cplot) with z values in colorbar

查看:65
本文介绍了如何使用颜色条中的 z 值生成线性颜色图 (cplot)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MATLAB™ 中可以使用

解决方案

IDL v8 为 PLOT 函数提供了一个易于使用的关键字,称为

z 数据缩放到颜色表编号 39 的字节索引.颜色条需要明确知道数据范围.

In MATLAB™ one can use cplot.m which can generate colored plot basically looks like 2d plot with 3rd axis (z-axis) value as colorbar. Is there any tool/plotting technique I can use to generate a similar plot in Python or IDL Programming Language?. The previous question on stack overflow dealing with different problem as given in a link.

解决方案

IDL v8 has an easy to use keyword for the PLOT function called VERT_COLORS:

; generate some sample data
x = cos(dindgen(100)/20)
y = sin(dindgen(100)/20)
z = dindgen(100)+100

; plot the data
p = plot(x, y, vert_colors=bytscl(z), rgb_table=39, xrange=[-2,2], yrange=[-2,2], thick=3, /aspect_ratio)
cb = colorbar(range=[min(z), max(z)], target=p)

The z data is scaled to a byte index of the colortable number 39. The colorbar needs to know the data range explicitly.

这篇关于如何使用颜色条中的 z 值生成线性颜色图 (cplot)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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