peekxc / Mapper

R package for computing the Mapper construction from Topological Data Analysis
http://peekxc.github.io/Mapper/
Other
6 stars 6 forks source link

Changing graph colour #12

Open cfloughrey opened 5 years ago

cfloughrey commented 5 years ago

Hi there,

I'm finding the Mapper package to be the most useful R package built for Mapper analysis so far, but have come across a stumbling block in my own use of it.

I am unable to figure out a way to edit the graph colour so it represents aspects of the data that aren't relevant to the filter function.

So for example, I'm using it for cancer patient analysis. I want to deconstruct my data on gene expression by a filter function, then assess whether flares identified in the graph actually correspond to patient subgroups.

Here is an image that hopefully shows what I mean, taken from Lum, P.Y., Singh, G., Lehman, A., Ishkanov, T., Vejdemo-Johansson, M., Alagappan, M., Carlsson, J. and Carlsson, G., 2013. Extracting insights from the shape of complex data using topology. Scientific reports, 3, p.1236., .

Any help would be much appreciated, Ciara

image

peekxc commented 5 years ago

Hi @CiaraNiLuachra,

May I ask what kind of plotting library you're using?

The Mapper package has a few libraries it can export to for visualizing. For static graphs, you can export to igraph, or you could use the built-in plotting functionality for higher-order complexes.

If you're looking for a more interactive vis, there are a couple libraries out there. I have a very early-stage library which Mapper exports too called pixiplex which supports shiny reactives for rendering (+ planned support for higher-order simplices). There are other libraries too that support interactive force-directed graph plots in R as well.

Alternatively, if you're not sure, let me know and I can come up with an example using shiny that shows how to 'highlight' aspects of the mapper

cfloughrey commented 5 years ago

Hi @peekxc ,

Thanks for the reply. I was using Mapper with the igraph library, but in the end resorted to using the TDAMapper package as it supplied a tutorial to colour vertices by the function of a co-variable that I was able to follow (also exporting to igraph).

I'm sure the same concept could've been applied to the your Mapper package, I was just missing the intuition to work it out.