- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
使用下面的最小示例,我得到的大图(大约 110k 点)的线图(使用 python 2.7、numpy 1.5.1、chaco/enable/traits 4.3.0)是这样的:
然而,这很奇怪,因为它是一个线图,里面不应该有任何填充区域吗?特别是因为数据是锯齿状信号?好像在y~=37XX处有一条线,上面有颜色填充?!但可以肯定的是,如果我放大一个区域,我会得到我期望的渲染 - 没有意外的填充:
这是错误 - 还是我做错了什么?我尝试使用 use_downsampling
,但没有任何区别...
测试代码:
import numpy as np
import numpy.random as npr
from pprint import pprint
from traits.api import HasTraits, Instance
from chaco.api import Plot, ArrayPlotData, VPlotContainer
from traitsui.api import View, Item
from enable.component_editor import ComponentEditor
from chaco.tools.api import PanTool, BetterSelectingZoom
tlen = 112607
alr = npr.randint(0, 4000, tlen)
tx = np.arange(0.0, 30.0-0.00001, 30.0/tlen)
ty = np.arange(0, tlen, 1) % 10000 + alr
pprint(len(ty))
class ChacoTest(HasTraits):
container = Instance(VPlotContainer)
traits_view = View(
Item('container', editor=ComponentEditor(), show_label=False),
width=800, height=500, resizable=True,
title="Chaco Test"
)
def __init__(self):
super(ChacoTest, self).__init__()
pprint(ty)
self.plotdata = ArrayPlotData(x = tx, y = ty)
self.plotobj = Plot(self.plotdata)
self.plotA = self.plotobj.plot(("x", "y"), type="line", color=(0,0.99,0), spacing=0, padding=0, alpha=0.7, use_downsampling=True)
self.container = VPlotContainer(self.plotobj, spacing=5, padding=5, bgcolor="lightgray")
#~ container.add(plot)
self.plotobj.tools.append(PanTool(self.plotobj))
self.plotobj.overlays.append(BetterSelectingZoom(self.plotobj))
if __name__ == "__main__":
ChacoTest().configure_traits()
最佳答案
我能够重现错误并与 John Wiggins(Enable 的维护者)交谈,这是 kiva 中的一个错误(chaco 用来在屏幕上绘制): https://github.com/enthought/enable好消息是,这是您可以使用的 kiva 后端之一中的错误。因此,要解决此问题,您可以选择不同的后端来运行脚本:
ETS_TOOLKIT=qt4.qpainter python <NAME OF YOUR SCRIPT>
如果您使用 qpainter 或 quartz,绘图看起来(在我的机器上)符合预期。如果您选择 qt4.image(Agg 后端),您将重现该问题。不幸的是,Agg 后端是默认后端。要更改它,您可以将 ETS_TOOLKIT 环境变量设置为该值:
export ETS_TOOLKIT=qt4.qpainter
坏消息是解决这个问题并不是一件容易的事。如果您想参与其中,请随时在 github 中报告错误(再次 https://github.com/enthought/enable)。如果你不这样做,我将在接下来的几天内记录下来。感谢您报告!
关于Python+Chaco+Traits - 渲染错误: unexpected fills of line plot of large data?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20367093/
我正在尝试在具有相同特征的盒装特征对象上实现特征。我以前对其方法采用的特征做过这样的事情&Self,它工作得很好,但不是Self。。我意识到在这个特定的例子中,我可以将fn get_*()函数更改为返
在编写带有特征的代码时,您可以将特征放在特征边界中: use std::fmt::Debug; fn myfunction1(v: Box) { println!("{:?}", v); }
我有一个特征正在使用另一个特征,现在我收到关于类中不存在的函数的错误。我简化了代码: 设置.php: getMessage());} } } ?> 数据库.php pdo=new PDO("m
这个问题在这里已经有了答案: Why doesn't Rust support trait object upcasting? (4 个回答) 2年前关闭。 如果我有 Box , 我可以返回 &dyn
给定这段代码: trait Trait {} struct Child; impl Trait for Child {} struct Father { child: &'a Box, } i
这个问题的标题与许多相关问题非常相似,但我还没有找到一个讨论这个特定问题的问题。 我有一个 Color非常简单定义的类型,如下所示: pub struct Color { red: u8,
我有三个特点。 Trait Param、GroupId 和 SessionId。特征 GroupId 和 SessionId 包括 Param。 类 GroupSession 包括特征 GroupId
查看 Traversable 和 TraversableLike 的 scaladoc,我很难弄清楚它们之间的区别是什么(除了一个扩展另一个)。文档中唯一明显的区别是它说 Traversable 是一
我有以下代码: trait T { type AT; fn foo(&self); } struct AbstractT { t: Box>, } impl T for Abs
如何在 Rust 中尝试类似以下的操作? builder 类是一个 trait 对象,它返回另一个 trait 对象(类型删除),其中选择的实现由我们正在使用的 builder trait 的特定对象
我想创建一个新向量,其中包含实现 Trait 的对象,来 self 已有的包含这些对象的一些向量。 trait Foo { // } struct Bar { i: i32, } st
到目前为止,在我的项目中,我使用了许多特征来允许在单元测试中模拟/ stub 以注入(inject)依赖项。然而,到目前为止我正在做的事情的一个细节似乎非常可疑,以至于我很惊讶它甚至可以编译。我担心正
假设我有一些特质: trait MyTrait { fn function1(&self); } 和一些实现它的类型: struct MyStruct { number: i32, }
更新:不止我一个人在思考这个问题,看来这确实是一个错误。参见 here .修复的那一天将是美好的一天! :) 这开始为 I love PHP traits! I'm going to use them
以下特征Parser[+T]是扩展接受 Input 的函数的特征并返回 Result[T] . trait Parser[+T] extends (Input => Result[T]) 那是对的吗
我有一个类型,我可以通过它访问它的方法 SomeTrait::::method() 但我不明白那和之间的区别 >::method() 在 C++ 中,我希望这样: SomeTrait::method(
在下面的代码中,不可能从对实现相同特征的动态大小类型的引用中获得对特征对象的引用。为什么会这样呢?如果我可以同时调用trait方法,那么&dyn Trait和&(?Sized + Trait)之间到底
我是 Rust 的新手,我想通过实现一些小项目来学习这门语言并更好地理解。我的第一次尝试是解析从 MQTT 代理收到的 JSON 数据。 我很高兴在 tornado 的帮助下轻松完成这项工作。和 se
在下面的代码中,不可能从对实现相同特征的动态大小类型的引用中获得对特征对象的引用。为什么会这样呢?如果我可以同时调用trait方法,那么&dyn Trait和&(?Sized + Trait)之间到底
这个问题在这里已经有了答案: Why is the `Sized` bound necessary in this trait? (2 个回答) 1年前关闭。 我有一个特质 Vertex我想要几个结构
我是一名优秀的程序员,十分优秀!