Skip to content
The Chat Archive
gpt-4.1-mini-2025-04-14· OpenAI LMArena Human Preference 140K

In PlantUML, you can represent a component by surrounding a word in brackets, and…

  1. User

    In PlantUML, you can represent a component by surrounding a word in brackets, and represent a dependency with a double arrow: -->. Is there a way to express multiple dependencies in the same line? Is there a way to color each dependency differently? Is there a way to position specific dependencies in different regions of the diagram?

  2. Assistant

    Great questions about PlantUML component diagrams! Let's break down each one:


    1. Expressing multiple dependencies in the same line

    In PlantUML, each arrow represents a single dependency between two components. You cannot directly express multiple dependencies in the same arrow line. Instead, you write multiple arrows, one per dependency, like this:

    [ComponentA] --> [ComponentB]
    [ComponentA] --> [ComponentC]
    

    If you want to keep the diagram compact, you can put multiple arrows on consecutive lines, but each arrow is a separate dependency.


    2. Coloring each dependency differently

    Yes! You can color arrows individually by adding color after the arrow, like this:

    [ComponentA] -->[red] [ComponentB]
    [ComponentA] -->[blue] [ComponentC]
    

    This will draw the arrow to ComponentB in red and the arrow to ComponentC in blue.


    3. Positioning specific dependencies in different regions of the diagram

    PlantUML automatically arranges components and arrows based on the layout engine, but you can influence positioning using:

    • Direction hints: Use left to right direction or top to bottom direction at the start of your diagram.
    • Splitting components into groups: Use package, node, or rectangle blocks to group components.
    • Using skinparam and layout hints: For example, together or order directives.
    • Manual positioning: You can use !define and !pragma layout smetana for advanced control, but this is more complex.

    Example of grouping:

    left to right direction
    
    package "Group 1" {
      [ComponentA]
      [ComponentB]
    }
    
    package "Group 2" {
      [ComponentC]
    }
    
    [ComponentA] -->[red] [ComponentB]
    [ComponentA] -->[blue] [ComponentC]
    

    This will visually separate components into regions.


    Summary

    QuestionAnswer
    Multiple dependencies on one line?No, use multiple arrows on separate lines.
    Color each dependency differently?Yes, add color after the arrow: -->[red].
    Position dependencies in different regions?Use package or rectangle to group components, and layout direction hints.

    If you want, I can help you with a sample diagram illustrating all these points! Would you like that?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.