packcircles
packcircles copied to clipboard
More general functions wanted
I can't believe that such an amazing package is not getting more attention than it is now. As for our general needs, I want to ask if such functions could be designed:
- When a data.frame with label and value is provided, can a convinient function provided to generate a figure? Or at least a single data.frame (instead of two) with enough information to plot.
- If I have a network, like edge list or igraph object, is there an easy way to transfer it to the circle pack in a function?
Thanks. Again, I want to show my appreciation to this awesome work.
Many thanks for your kind words.
For your first suggestion, do you mean that you want to provide a label in the input data that will be carried along to the output and, perhaps, also be used by the circleVertices
function?
For your second suggestion, does the circleGraphLayout
function help at all? It not, can you provide a small example of what you would like to do?
Michael
Thank you for the prompt feedback.
For the first suggestion, I mean the package could wrap a function so that when we have data.frame like:
data("bacteria")
head(bacteria)
## value colour label
## 1 4232 #DDF379 Dehalogenimonas sp. WBC-2
## 2 5097 #F3C679 Desulfatibacillum alkenivorans AK-01
## 3 2825 #79F398 Opitutus terrae PB90-1
## 4 3471 #F3C679 Geobacter
## 5 7515 #79F3EA Methanosaeta harundinacea 6Ac
## 6 2476 #C4F379 Rubinisphaera brasiliensis DSM 5305
We can reach the plot in an one-station function. Currently these functions provide us with the facilities to calculate the coordinates of the polygons and the center of them. It would be convenient if you can wrap it up and make it a function so we could get to the destination at no time (but it makes the package have more dependencies, if this is not disirable, maybe making another package could help).
For the second suggestion, I think I've found the answer in the ggraph
package which makes plots like (see https://www.r-graph-gallery.com/circle-packing.html):
using the network data. Network data might not be accurate because it displays hierarchy in essence.
Yes, the ggraph
package is your friend if you need to do hierarchical packings.
If I understand your first suggestion correctly, you want to be able to go from the data frame straight to a ggplot object - is that right? Perhaps one way of doing that without adding dependencies to packcircles
would be to have a second package that implements a geom_packcircles
function. It seems like a nice idea!
That is exactly what I mean, and expect for the geom_packcircles
to emerge in a new package or in ggplot2
. And the interative feature is awesome too, hope it could be implemented in the new package or in the plotly
package which supports ggplot2
as well.