Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrows #45

Closed
dnjst opened this issue Dec 21, 2023 · 2 comments
Closed

Arrows #45

dnjst opened this issue Dec 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@dnjst
Copy link

dnjst commented Dec 21, 2023

This is a terrific package!

I was wondering, when calling circos.link(), is there a way to draw a black arrow with the line in the middle and arrowhead located in the middle of the sector/region I call it from, rather than the wide chords or arrows? like -----> or Figure 3.23 in this link: https://jokergoo.github.io/circlize_book/book/graphics.html#circular-arrows

Thanks

@moshi4
Copy link
Owner

moshi4 commented Dec 21, 2023

Hi @dnjst,

is there a way to draw a black arrow with the line in the middle and arrowhead located in the middle of the sector/region

Currently, pyCirclize does not have this functionality.
I think it is not difficult to implement, so I will consider adding it at the next release.

@moshi4 moshi4 mentioned this issue Dec 26, 2023
@moshi4
Copy link
Owner

moshi4 commented Dec 26, 2023

circos.link_line() method is added in the newly released pyCirclize v1.2.0.

Code Example

from pycirclize import Circos

sectors = {"A": 10, "B": 20, "C": 15}
name2color = {"A": "red", "B": "blue", "C": "green"}
circos = Circos(sectors, space=5)
for sector in circos.sectors:
    track = sector.add_track((95, 100))
    track.axis(fc=name2color[sector.name])
    track.text(sector.name, color="white", size=12)
    track.xticks_by_interval(1)

# Plot link lines in various styles
circos.link_line(("A", 0), ("A", 7))
circos.link_line(("A", 9), ("B", 3), direction=1, color="red")
circos.link_line(("B", 5), ("B", 7), direction=-1, color="blue", lw=1.0)
circos.link_line(("B", 8), ("B", 15), r1=90, r2=90, direction=2, color="green", ls="dashed")

circos.link(("B", 17, 19), ("C", 11, 9), color="black")
circos.link_line(("B", 18), ("C", 10), direction=1, arrow_height=6, arrow_width=4, color="white", lw=1.0)

circos.savefig("example.png")

example.png

example

@moshi4 moshi4 closed this as completed Dec 26, 2023
@moshi4 moshi4 added the enhancement New feature or request label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants