5 votos

Bibliotecas para gráficos de bosque y de embudo

¿Puede alguien recomendarme una biblioteca gráfica de código abierto para crear gráficos de bosque y de embudo?

Mi objetivo era utilizarlo en una aplicación de escritorio Java.

5voto

Eric Davis Puntos 1542

El rmeta en R puede producir gráficos de bosque y de embudo.

http://cran.r-project.org/web/packages/rmeta/index.html

5voto

jdelator Puntos 1336

Bueno, yo uso graphviz que tiene enlaces Java (Grappa ).

Aunque el lenguaje dot (la sintaxis de graphviz) es simple, prefiero usar graphviz como una biblioteca a través de los excelentes y estables enlaces de python, pygraphviz y redx .

Aquí está el código para un simple 'diagrama de embudo' usando esas herramientas; no es el diagrama más elaborado, pero está completo--inicializa el objeto gráfico, crea todos los componentes necesarios, los estiliza, renderiza el gráfico, y lo escribe en un archivo.

import networkx as NX
import pygraphviz as PV

G = PV.AGraph(strict=False, directed=True)     # initialize graph object

# create graph components:
node_list = ["Step1", "Step2", "Step3", "Step4"]
edge_list = [("Step1, Step2"), ("Step2", "Step3"), ("Step3", "Step4")]
G.add_nodes_from(node_list)
G.add_edge("Step1", "Step2")
G.add_edge("Step2", "Step3")
G.add_edge("Step3", "Step4")

# style them:
nak = "fontname fontsize fontcolor shape style fill color size".split()
nav = "Arial 11 white invtrapezium filled cornflowerblue cornflowerblue 1.4".split()
nas = dict(zip(nak, nav))
for k, v in nas.iteritems() :
    G.node_attr[k] = v

eak = "fontname fontsize fontcolor dir arrowhead arrowsize arrowtail".split()
eav = "Arial 10 red4 forward normal 0.8 inv".split()
eas = dict(zip(eak, eav))
for k, v in eas.iteritems() :
    G.edge_attr[k] = v

n1 = G.get_node("Step1")
n1.attr['fontsize'] = '11'
n1.attr['fontcolor'] = 'red4'
n1.attr['label'] = '1411'
n1.attr['shape'] = 'rectangle'
n1.attr['width'] = '1.4'
n1.attr['height'] = '0.05'
n1.attr['color'] = 'firebrick4'
n4 = G.get_node("Step4")
n4.attr['shape'] = 'rectangle'

# it's simple to scale graph features to indicate 'flow' conditions, e.g., scale 
# each container size based on how many items each holds in a given time snapshot:
# (instead of setting node attribute ('width') to a static quantity, you would
# just bind 'n1.attr['width']' to a variable such as 'total_from_container_1'

n1 = G.get_node("Step2")
n1.attr['width'] = '2.4'

# likewise, you can do the same with edgewidth (i.e., make the arrow thicker
# to indicate higher 'flow rate')

e1 = G.get_edge("Step1", "Step2")
e1.attr['label'] = '  1411'
e1.attr['penwidth'] = 2.6

# and you can easily add labels to the nodes and edges to indicate e.g., quantities: 
e1 = G.get_edge("Step2", "Step3")
e1.attr['label'] = '  392'

G.write("conv_fnl.dot")      # save the dot file
G.draw("conv_fnl.png")       # save the rendered diagram

texto alternativo http://a.imageshack.us/img148/390/convfunnel.png

2voto

Justin Tanner Puntos 5437

Además del paquete rmeta, también existe el paquete meta en R, que produce gráficos de calidad de publicación.

i-Ciencias.com

I-Ciencias es una comunidad de estudiantes y amantes de la ciencia en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X