cytoscape / RCy3

New version of RCy3, redesigned and collaboratively maintained by Cytoscape developer community
MIT License
49 stars 20 forks source link

remove labels of nodes or edges? #66

Closed yiluheihei closed 5 years ago

yiluheihei commented 5 years ago

Thanks for your great work!

I can't find the api to remove labels of nodes or edges after reading the help page? Is there have something I have missed?

Thank you very much.

AlexanderPico commented 5 years ago

Thanks for your question. Anything you can do using cyREST, you should be able to do using RCy3. Sometimes, there is higher-level helper function and sometimes you just have to use the cyrest*** methods directly.

For example, in this case, the first thing I did was open up the cyREST API with cyrestAPI() function and then browsed under Visual Styles to find the DELETE method you are looking for. Then I composed this command:

cyrestDELETE('styles/galFiltered Style/mappings/NODE_LABEL')
# note: the second path arg is the name of the visual style you are working with and the fourth is the name of the visual property.

Voila!

yiluheihei commented 5 years ago

@AlexanderPico Thank you so much for your prompt reply.

According to your explanation, the edge label can be removed by setting the default unmapped edge label to "" using setEdgeLabelDefault() and remove the mapped edge label using cyrestDELETE()

setEdgeLabelDefault("", <visual style>)
cyrestDELETE(paste("styles", <visual style>, "mappings", "EDGE_LABEL", sep="/")