- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
例如,如果绘图有五个数据点,比如 x 轴上的 1-5。但我只想通过跳过 2 和 4 在 1,3 和 5 处绘制点。我一直在 1,3,5 处绘制点。但我无法用一条线连接这三点。谁能帮我解决这个问题提前致谢
这是我正在使用的代码
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
{
NSInteger valueCount = [[[CPDStockPriceStore sharedInstance] datesInMonth] count];
switch (fieldEnum) {
case CPTScatterPlotFieldX:
if ((index < valueCount) && ((index%3)==0)) {
return [NSNumber numberWithUnsignedInteger:(index)];
}
break;
case CPTScatterPlotFieldY:
if ([plot.identifier isEqual:CPDTickerSymbolAAPL] == YES)//graph1{
return [[[CPDStockPriceStore sharedInstance] monthlyPrices:CPDTickerSymbolAAPL] objectAtIndex:index];
} else
if (([plot.identifier isEqual:CPDTickerSymbolGOOG] == YES) && ((index%3)==0))//graph2 {
return [[[CPDStockPriceStore sharedInstance] monthlyPrices:CPDTickerSymbolGOOG] objectAtIndex:index];
} else if ([plot.identifier isEqual:CPDTickerSymbolMSFT] == YES)//graph3 {
return [[[CPDStockPriceStore sharedInstance] monthlyPrices:CPDTickerSymbolMSFT] objectAtIndex:index];
}
break;
}
return [NSDecimalNumber notANumber];
}
这里有三个不同的图形,只有当索引 % 3 等于 0 时,graph2 才会绘制点。现在我想加入这个 graph2 绘制的所有点。这段代码取自raywenderlich core plot example。
最佳答案
要仅绘制三个点,请让 -numberOfRecordsForPlot:
返回三 (3)。 x 值不必等于索引。
Index x y----------------------- 0 1 y0 1 3 y1 2 5 y2
关于iOS Scatter core Plot,如何用一条线连接两点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18736557/
我有几个 pandas 数据框。我想在单独的散点图中相互绘制几列,并将它们组合为图中的子图。我想相应地标记每个子图。我在让子图标签正常工作方面遇到了很多麻烦,直到我发现据我所知,有两种直接从数据帧进行
使用 Dask 分布式分散广播列表的合适方法是什么? 案例 1 - 包装列表: [future_list] = client.scatter([my_list], broadcast=True) 情况
使用 Dask 分布式分散广播列表的合适方法是什么? 案例 1 - 包装列表: [future_list] = client.scatter([my_list], broadcast=True) 情况
我有一个包含数组元素的列表: [array([2.40460915, 0.85513601]), array([1.80998096, 0.97406986]), array([2.14505475,
我想显示一些点。这是我的代码: plt.scatter(y[:,0],y[:,1],c=col) plt.show() 并作为 col我有: Col: [1 1 0 1 1 1 1 0 0 0 1
当我在 OSX Yosemite 上运行它时,生成的颜色条有奇怪的白线(见下图)。有什么方法可以生成没有这些难看的线条的颜色条吗? import pylab import numpy x = nump
我已成功绘制了两个图表,但当我绘制第三个图表时,出现无效语法错误。我是否遗漏了一些非常明显的东西? x=df['time'] d=df['dist'] x2=df2['time'] d2=df2['d
我的每个进程都有一个值数组 v 和一个大小相同的进程 ID pid 数组。 pid[i] 指定要将项目 v[i] 发送到哪个进程。 我需要实现一个分散操作(当然还有相应的聚集操作)。 进程 ID 数组
如何使用核心图绘制有间隙的散点图?我正在使用核心绘图库。一切正常,但现在我想在数据线的开头或中间做一个有间隙的散点图?有人帮我吗? 最佳答案 让数据源返回nil 或[NSNull null]。例如,如
我有一些代码可以绘制一些点。我将 ax.scatter 替换为 ax.plot,这样我就可以单独控制每个点的颜色。但是,当我进行此更改时,x 轴和 y 轴的范围似乎会增加。 我无法确定为什么会这样。我
从我复制到自己服务器的已知公共(public)数据集开始。 数据集在这里:https://www.kaggle.com/imdevskp/corona-virus-report/download im
我正在使用 Bokeh 将 ~700 次模拟的结果与使用散点图的另一组结果进行对比。我想使用悬停工具通过分配标识模拟参数的自定义索引来定性地确定数据中的模式。 在下面的代码中,x和 y是来自 Pand
这个问题在这里已经有了答案: matplotlib scatter edge without specifying edgecolor (1 个回答) 3年前关闭。 我想通过使用 2 个索引 [Chi
我希望更好地理解流行的 EIP 分散聚集中的多个分离器、转换器和聚合方法。 用例是我发送一些可以对应于多种不同类型的 XML。我想分割 header 中指定的类型(每种类型不同)并通过与每种类型对应的
考虑以下示例(取自 Stackoverflow 上的另一篇文章): require(ggplot2) d <- data.frame(x = c(102856,17906,89697,74384,91
我有许多带有形状的矩阵 w1、w2、w3...wn (k*n1 、k*n2、k*n3...k*nn) 和 x1、x2、x3...xn 具有形状(n1*m、n2*m、n3*m...nn*m >). 我想
假设我的数据按以下方式组织: x_values = [6.2, 3.6, 7.3, 3.2, 2.7] y_values = [1.5, 3.2, 5.4, 3.1, 2.8] colours = [
我对 Spring Integration 还是很陌生,我尝试使用 IntetrationFlowDefinition.scatterGather() 但无济于事。总体思路是: 将一个String作为
我有一个谷歌分散图,我希望当鼠标悬停在圆圈上时,然后打开一个包含自定义字符串的信息窗口。 例如教程 https://developers.google.com/chart/interactive/do
好吧,我了解 JFreeChart 和其他人,但我正在编写自己的简单散点图。我已经有了一个箱形图(没有 y 轴标签,但当我在报告中解释它时,这不应该是一个大问题)。 我有一个基本的散点图类,但是我尝试
我是一名优秀的程序员,十分优秀!