One node showing multiple colours

13 views
Skip to first unread message

WLigt...@gmail.com

unread,
Sep 28, 2005, 10:23:14 AM9/28/05
to cytoscape-discuss
Since one of the things I want to do is showing Expression data on my
pathways, I want to be able to show multiple colours within one node.
So the user can see the results of multiple expression experiments in
one graph.
This is one of the most requested features in GenMAPP, I've been told.
And I want to know if there is at this moment the possibilty to do
that, or not.
If not, I want to create that possibility myself.
The idea is, that within the node, more than one colour can be painted.
This is easiest with the round nodes, the ellipses.
I would want to propose the following, that with each extra colour, the
circle is divided in the amounts of colours and painted like a
piechart. And then layed out like a clock. And the order of the colours
is clockwise.
check http://www.wligtenberg.nl/images/stories//idea.gif
For the idea what this would look like.
I want to know, if it is possible, which isn;t the case I think.
And then I would also want to know what other people think of this
idea, and if someone has any idea where to start.

Cheers,

Willem Ligtenberg

WLigt...@gmail.com

unread,
Sep 28, 2005, 10:34:30 AM9/28/05
to cytoscape-discuss
I;ve just found this page:
http://csbi.sourceforge.net/screenshots.html
That is from GINY.
So it should be possible. I see now.
So Rowan, I am really interested in the options shown in this image:
http://csbi.sourceforge.net/images/custom_nodes.jpg
Can you please let me know how to create them?
Because also the radar nodes maybe exactly what I need!!

James Mcininch

unread,
Sep 29, 2005, 11:16:31 AM9/29/05
to cytoscap...@googlegroups.com

I ran across documentation on this in the GINY source just the other day.

If I run across it again, I'll send a more specific citation, but if I recall correctly, you need to create a
NodeView that extends PNodeView and simply override the painting. That's how you get
custom representations of nodes. I didn't go the step farther to check how one might get the
custom NodeView used, but I'm sure it's in there (don't have the docs in front of me now).

Marcio da Silva

unread,
Sep 29, 2005, 12:36:36 PM9/29/05
to cytoscap...@googlegroups.com
On 9/29/05, James Mcininch <James.M...@biogenidec.com> wrote:
>
> I ran across documentation on this in the GINY source just the other day.
>
> If I run across it again, I'll send a more specific citation, but if I
> recall correctly, you need to create a
> NodeView that extends PNodeView and simply override the painting. That's how
> you get
> custom representations of nodes. I didn't go the step farther to check how
> one might get the
> custom NodeView used, but I'm sure it's in there (don't have the docs in
> front of me now).

I have tried something like this but run into some problems. Take a look at:

http://cytoscape.org/cgi-bin/moin.cgi/ChangingNodeView

for more info.

Marcio

Rowan Christmas

unread,
Sep 29, 2005, 2:29:43 PM9/29/05
to cytoscap...@googlegroups.com
I would love to see more radar-node stuff used.

I think that I was trying to be too ambitious and make these nodes do
too much, but I think that the 3 of us could probably come up with a
nice RadarNode API that would allow for a variety of nodes to be
drawn.

I will contact you guys directly and maybe we can start getting this in order.

--rowan

Jim Vlasblom

unread,
Sep 29, 2005, 9:51:04 PM9/29/05
to cytoscape-discuss
This sounds similar to what we're doing. Screenshot:
http://individual.utoronto.ca/jvlasblom/pnodes.jpg

We created our own node class that extends PPath. For each node, we
draw the wedges (pie slices) using the 'moveTo' and 'lineTo' commands.
We then use the setPaint method to fill the wedge.

Jim Vlasblom

Marcio da Silva

unread,
Sep 30, 2005, 3:53:14 AM9/30/05
to cytoscap...@googlegroups.com
Hi all,

On 9/30/05, Jim Vlasblom <j...@zoidb.org> wrote:
>
> This sounds similar to what we're doing. Screenshot:
> http://individual.utoronto.ca/jvlasblom/pnodes.jpg
>
> We created our own node class that extends PPath. For each node, we
> draw the wedges (pie slices) using the 'moveTo' and 'lineTo' commands.
> We then use the setPaint method to fill the wedge.

And here is my screenshot:

http://csresources.sourceforge.net/md4.png

I could change the shape of the node and add tooltips, but I cannot
relayout it (using one of the layouts in the "Layout" menu, but I can
move them with the mouse), the context menu doesn't work and I cannot
delete the nodes, that mean, I cannot change back to the normal
network visualization (the shaped nodes are, actually, metanodes).

Jim, if you got better results, could you add your experience to the
wiki? Here (or start a new page, if you wish):

http://cytoscape.org/cgi-bin/moin.cgi/ChangingNodeView

Thanks,

Marcio

WLigt...@gmail.com

unread,
Sep 30, 2005, 5:43:12 AM9/30/05
to cytoscape-discuss
I think it is a very good idea to get together on this and create a
nice looking node, that can do the things most people are interested
in. Because, ofcourse the layouters should still work and things like
that. Also you should be able to update the colours or anything that
the node consists of after creation.
I think it would be very good, to get all people who have experience
with this, together and create a good addition to Cytoscape.
I will gladly volunteer to help creating these new node types!

Nerius Landys

unread,
Sep 30, 2005, 2:41:54 PM9/30/05
to cytoscape-discuss
Hi. My name is Nerius and I am a Cytoscape core developer.
I'm actually in the process of rewriting the entire rendering engine for
Cytoscape in order to address performance and correctness issues. The
rewrite of the rendering will be available in a Cytoscape release at the
beginning of next year.

Unless I drastically change the design of my rendering code, the only way
that it will be possible to draw these "pie-graph" sorts of nodes in
next year's release will be to be very clever in setting a java.awt.Paint
for each node. Do you think that control of a node's Paint is enough of a
hook to get the kinds of nodes you want to see?

Marcio da Silva

unread,
Sep 30, 2005, 3:59:45 PM9/30/05
to cytoscap...@googlegroups.com
On 9/30/05, Nerius Landys <nla...@bioeng.ucsd.edu> wrote:
>
> Hi. My name is Nerius and I am a Cytoscape core developer.
> I'm actually in the process of rewriting the entire rendering engine for
> Cytoscape in order to address performance and correctness issues. The
> rewrite of the rendering will be available in a Cytoscape release at the
> beginning of next year.
>
> Unless I drastically change the design of my rendering code, the only way
> that it will be possible to draw these "pie-graph" sorts of nodes in
> next year's release will be to be very clever in setting a java.awt.Paint

That's more or less the way I did it. See:

http://cytoscape.org/cgi-bin/moin.cgi/ChangingNodeView

> for each node. Do you think that control of a node's Paint is enough of a
> hook to get the kinds of nodes you want to see?

If you think with the new rendering code and using the paint() method
I will not have the problems described in the above page, for me it is
ok!

Marcio

Nerius Landys

unread,
Sep 30, 2005, 5:20:11 PM9/30/05
to cytoscap...@googlegroups.com
Actually I did not mean that you will be able to override paint(). I
meant that you will be able to set a java.awt.Paint for every node.
java.awt.Paint is an interface that describes how (in which color, etc)
some shape is to be rendered.

WLigt...@gmail.com

unread,
Oct 1, 2005, 5:57:49 AM10/1/05
to cytoscape-discuss
I thought this is already possible:
http://csbi.sourceforge.net/API/giny/view/NodeView.html
Then with NodeView.setUnselectedPaint(java.awt.Paint paint)
You can specify the colour.
It might be an idea, to change this into
NodeView.setUnselectedPaint(java.awt.Paint paint, float fraction)
And then
NodeView.setUnselectedPaint(java.awt.Paint paint)
will do: NodeView.setUnselectedPaint(java.awt.Paint paint, 1)
And then it would be perfectly easy for anyone to implement the
piecharts.

Jim Vlasblom

unread,
Oct 2, 2005, 11:05:56 PM10/2/05
to cytoscape-discuss
As I understand it, java.awt.paint only allows one to specify how a
node is filled. Would we still be able to have nodes that have
different shapes, like radar nodes? (Round nodes with rectangular
spikes jutting out)

Jim

WLigt...@gmail.com

unread,
Oct 3, 2005, 4:14:54 AM10/3/05
to cytoscape-discuss
I now know, that this: NodeView.setUnselectedPaint(java.awt.Paint
paint)
Is something else than Nerius means.
Because he is talking about the Node itself, and that is about the
NodeView.
Which as I now know, is a lot better. Because at this moment when I
change the colour of the node, and change to another network and back,
the node colouring is gone.
(Because a new NodeView has been generated?)
So allowing users to define a Node colour is indeed, something that is
high on my wishlist.
I still think that it would be very usefull, to create a dev group for
new nodes. Maybe something for the hackathon? (Which I want to attend,
if I can get some funding for it)

Nerius Landys

unread,
Oct 3, 2005, 11:53:10 AM10/3/05
to cytoscape-discuss
> As I understand it, java.awt.paint only allows one to specify how a
> node is filled. Would we still be able to have nodes that have
> different shapes, like radar nodes? (Round nodes with rectangular
> spikes jutting out)

yes you would. You would have control of shape and paint. However, the
shape must satisfy certain criteria (this will be strictly enforced). A
radar node would meet that criteria.

James Mcininch

unread,
Oct 3, 2005, 12:32:23 PM10/3/05
to cytoscap...@googlegroups.com

Just to offer my two cents:

Defining a java.awt.Paint object for the node isn't sufficient. Better to implement some abstract
NodeGlyph class that has a member function that takes a Graphics2D object and allows you
to do whatever you want (perhaps within a fixed NxM unit cell). Then you could simply move to
the approriate offset for the Node, and render the glyph at a scale approraite to the zoom
level.

I would go so far as to say that a NodeGlyph should have a static implementation and that each
NodeView would simply note the class of NodeGlyph. For each Glyph, simply call the paint()
method with the Graphics2D reference.

That way, you could have a default drawing method for nodes, and just pop in a new rendering
routine that can more or less do anything it wants.
Reply all
Reply to author
Forward
0 new messages