Coder Social home page Coder Social logo

Install pygraphviz fails about oemof-tabular HOT 1 OPEN

nailend avatar nailend commented on September 26, 2024
Install pygraphviz fails

from oemof-tabular.

Comments (1)

nailend avatar nailend commented on September 26, 2024

@SabineHaas In case you want to plot graphs with pygraphviz

e.g. BEV component

def draw_graph(energysystem):
    # Draw the graph

    from oemof.network.graph import create_nx_graph

    G = create_nx_graph(energysystem)

    # Specify layout and draw the graph
    pos = nx.drawing.nx_agraph.graphviz_layout(
        G, prog="neato", args="-Gepsilon=0.0001"
    )

    fig, ax = plt.subplots(figsize=(10, 8))
    node_colors = list()
    for i in list(G.nodes()):
        if "storage" in i:
            node_colors.append("royalblue")
        elif "BEV-V2G" in i:
            node_colors.append("firebrick")
        elif "BEV-G2V" in i:
            node_colors.append("lightblue")
        elif "BEV-inflex" in i:
            node_colors.append("darkviolet")
        elif "excess" in i:
            node_colors.append("green")
        elif "shortage" in i:
            node_colors.append("yellow")
        elif "load" in i:
            node_colors.append("orange")
        elif "wind" in i:
            node_colors.append("pink")
        elif "bus" in i:
            node_colors.append("grey")
        else:
            node_colors.append("violet")

    nx.draw(
        G,
        pos,
        # **options,
        with_labels=True,
        node_size=3000,
        # node_color='lightblue',
        font_size=10,
        font_weight="bold",
        node_color=node_colors,
        # node_color=["red", "blue", "green", "yellow", "orange"],
    )
    labels = nx.get_edge_attributes(G, "weight")
    nx.draw_networkx_edge_labels(G, pos=pos, edge_labels=labels)

    # Customize the plot as needed
    ax.set_title("OEMOF Energy System Graph")

    # Show the plot
    plt.show()
    ```

from oemof-tabular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.