小编Tom*_*ens的帖子

matplotlib:改变线的颜色以捕获数据中的自然时间参数化

我试图改变从两个数组中的数据绘制的线的颜色(例如ax.plot(x,y)).颜色应作为索引变化xy增加.我基本上是试图捕捉自然的"时间"的数据在阵列参数xy.

在一个完美的世界里,我想要一样的东西:

fig = pyplot.figure()
ax  = fig.add_subplot(111)
x   = myXdata 
y   = myYdata

# length of x and y is 100
ax.plot(x,y,color=[i/100,0,0]) # where i is the index into x (and y)
Run Code Online (Sandbox Code Playgroud)

生产一条颜色从黑色到深红色变为亮红色的线.

我已经看到了一些适用于绘制由某个'time'数组显式参数化的函数的例子,但我无法使用原始数据...

matplotlib

12
推荐指数
1
解决办法
3418
查看次数

kcachegrind:以下函数没有可用的源代码

我正在尝试查看带注释的源,$ valgrind --tool=callgrind ./myProgram然后$ kcachegrind使用Ubuntu 12.04(我在$ qcachegrind使用Mac OSX时遇到了同样的问题).

C++脚本myProgram.cpp调用生活在.hpp文件中的函数(通过#include "../include/myHeader.hpp"等).我myProgram.cpp像这样编译:

g++ -g -o myProgram myProgram.o -l<some third party lib>
Run Code Online (Sandbox Code Playgroud)

我不关心查看第三方库的注释源.

我想看到的是 函数in myHeader.hpp和for的注释源myProgram.cpp.

相反,我看到 kcachegrind的Flat Profile窗口,其中列出了所有被调用的函数,包括函数myHeader.hpp- 这很棒.现在,kcachegrind报告函数的位置myHeader.hpp来自myProgram- 这很奇怪.最后,当我从Flat Profile窗口中选择任何函数并请求查看源代码时,我遇到了:

There is no source available for the following function
<name of the selected function>
This is because no debug information is present.
Recompile the source …
Run Code Online (Sandbox Code Playgroud)

c++ profiling callgrind kcachegrind

5
推荐指数
1
解决办法
2438
查看次数

标签 统计

c++ ×1

callgrind ×1

kcachegrind ×1

matplotlib ×1

profiling ×1