zedgraph。如何绘制散点图,但每个点的颜色不同 [英] zedgraph. How to draw scatter plots but with different color for each dot

查看:176
本文介绍了zedgraph。如何绘制散点图,但每个点的颜色不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望函数AddLine



I wish the function AddLine

LineItem myCurve = myPane1.AddCurve("", x_axis_array, Y_AxixArray, Color.Black, SymbolType.Diamond);



可以选择:




could have an option of:

LineItem myCurve = myPane1.AddCurve("", x_axis_array, Y_AxixArray,COLOR_ARRAY[],  SymbolType.Diamond);





希望你得到了我想做的事。



非常感谢任何答案。!



Hopefully you get what I want to do.

Any answer is highly appreciated.!

推荐答案

   Color currentColor = myColorArr[0];<br />
               //int startidx = 0;<br />
               for (int i = 0; i < datacount; i++)<br />
               {<br />
                   if (currentColor == myColorArr[i])<br />
                   {<br />
                       list_x.Add(list_x[i]);<br />
                       list_y.Add(list_y[i]); <br />
                   }<br />
                   else<br />
                   {<br />
                       list_x.Add(list_x[i]);<br />
                       list_y.Add(list_y[i]);<br />
<br />
                       LineItem myCurve1 = myPane1.AddCurve("", list_x.ToArray(), list_y.ToArray(), myColorArr[i-1],SymbolType.Diamond);<br />
                       myCurve1.Line.IsVisible = true; // was false for scatter plot<br />
                       myCurve1.Symbol.Fill = new Fill(myColorArr[i - 1]);<br />
                       list_x.Clear();<br />
                       list_y.Clear();<br />
                       currentColor = myColorArr[i];<br />
                       list_x.Add(list_x[i]);<br />
                       list_y.Add(list_y[i]); <br />
                   }<br />
               }







感谢您的帮助!




Thanks for your help!


(我假设您正在讨论开源 zedgraph [ ^ ])



您可以下载代码并自行进行修改;如果有效,请将更改提交给zedgraph项目。



除此之外,我不知道zedgraph。





M。
(I assume you are talking about the opensource zedgraph[^])

You could download the code and do the modification yourself; and if that works, submit the changes to the zedgraph project.

Other than that, I don't know zedgraph.


M.


无需对相同颜色的点进行分组,请参见下面的示例



No need to group the point with same color,see example as below

GraphPane gp=ZedGraphControl.GraphPane;
PointPairList pointXY=new PointPairList();
pointXY.Add(1,1);
LineItem point=gp.AddCurve("Label",pointXY,YourColor,SymbolType.Circle);





然后将绘制圆形符号,您可以用目标颜色填充圆形符号



then a circle symbol will be plotted, you can fill the circle symbol with your target color


这篇关于zedgraph。如何绘制散点图,但每个点的颜色不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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