[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Color of scatter?
From: |
David Bateman |
Subject: |
Re: Color of scatter? |
Date: |
Fri, 03 Apr 2009 22:27:28 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.17 (X11/20081018) |
Rob Mahurin wrote:
On Mar 31, 2009, at 11:35 AM, David Doria wrote:
I would expect this to produce a red marker at (1,1). It is, however,
green. Am I mis-interpreting the syntax? The red marker is what I
see in
matlab.
scatter(1,1,[],[1 0 0])
I see a red marker with octave 3.0.3, but a green marker in a recent
development version. I don't know enough to track down the bug, though.
Cheers,
Rob
Does the attached changeset fix the issue? The problem as I see it was
that the creation of a matlab compatible scatter group required that
each point in the scatter plot was a separate patch. The indexing into
the cdata values was incorrect for a fixed color as a three element
vector like you gave.
D.
--
David Bateman address@hidden
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1238790221 -7200
# Node ID 136e72b9afa8ce589acf8f7babfd2b8212e5e96b
# Parent b7210faa3ed0d9b52d730309c88c46668d1cb836
correct indexing of cdata for scatter
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-03 David Bateman <address@hidden>
+
+ * plot/__scatter__.m: correct indexing of cdata.x
+
2009-04-03 Jaroslav Hajek <address@hidden>
* optimization/fminunc.m: New function.
diff --git a/scripts/plot/__scatter__.m b/scripts/plot/__scatter__.m
--- a/scripts/plot/__scatter__.m
+++ b/scripts/plot/__scatter__.m
@@ -149,7 +149,8 @@
h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:),
"faces", 1, "vertices", [x(i), y(i), z(i,:)],
"facecolor", "none", "edgecolor", "flat",
- "cdata", c(i), "marker", marker, "markersize", s(i),
+ "cdata", reshape(c(i,:),[1,size(c)(2:end)]),
+ "marker", marker, "markersize", s(i),
"linestyle", "none");
if (filled)
set(h, "markerfacecolor", "flat");
@@ -215,14 +216,28 @@
endif
hlist = get (h, "children");
if (ischar (c1))
- for i = 1 : length (hlist)
- set (hlist(i), "vertices", [x1(i), y1(i), y2(i)], "cdata", c1,
- "markersize", size1(i));
- endfor
+ if (isempty (z1))
+ for i = 1 : length (hlist)
+ set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", c1,
+ "markersize", size1(i));
+ endfor
+ else
+ for i = 1 : length (hlist)
+ set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", c1,
+ "markersize", size1(i));
+ endfor
+ endif
else
- for i = 1 : length (hlist)
- set (hlist(i), "vertices", [x1(i), y1(i), y2(i)], "cdata", c1(i,:),
- "markersize", size1(i));
- endfor
+ if (isempty (z1))
+ for i = 1 : length (hlist)
+ set (hlist(i), "vertices", [x1(i), y1(i)], "cdata",
+ reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i));
+ endfor
+ else
+ for i = 1 : length (hlist)
+ set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata",
+ reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i));
+ endfor
+ endif
endif
endfunction