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

Find a way to draw lattice bonds (and next-nearest-neighbor links) with gnuplot backend #3

Open
beddalumia opened this issue Sep 19, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@beddalumia
Copy link
Member

Refer to commit message in 99061ce.

@beddalumia
Copy link
Member Author

beddalumia commented Sep 21, 2022

Gnuplot experts: your intervention is most welcomed :)

@beddalumia beddalumia added the help wanted Extra attention is needed label Sep 25, 2022
@14NGiestas
Copy link

You could use the set object and an unfilled polygon

main

Or with arrows and arrowstyle (I guess this one fits better) but with the current API you would need to build the options string for each entry.

http://www.gnuplotting.org/arrow-with-t-shaped-head/

http://www.gnuplot.info/demo/arrowstyle.html

(far from expert here)

@beddalumia
Copy link
Member Author

Oh, thanks for the comment!

  • The unfilled polygon could actually be the ideal solution for hex_plot, which for now I found quite unsatisfying with its unlinked points (with pyplot too): the idea therein is to take an array of hex(agons) and plot them, so the focus should not be on the vertices but rather on the whole hexagon. I like the idea of a polygon very much here, I'll surely take a look soon.

  • Your guess is right about xy_plot instead, arrows seem quite appropriate for arbitrary links between lattice points. I do not really understand what is your warning about but probably it relates with my main perplexity: to plot links between (pairs of) points I need to give a command for each of them, in a loop. But ogpf's plot method does "dispatch" everything to gnuplot at each call so I would end up with many figures, each one with just one pair of points (and the arrow linking them). Maybe I could find a workaround for arrows alone, but how to interleave point-plotting and arrows, in a unique plot? I mean, without generating myself a whole gnuplot script (as it has been done in the dark ages before ogpf 🙃).

@14NGiestas
Copy link

It is just a minor annoyance with the low-level options:
Let's say you have the coordinates in x and y, to use OGPF api in each link you would need to

real :: x(2),y(2)
! just allocating space in a fancy way here, 
! I suppose both `set macros` and `@noheads` macro are defined
character(:), allocatable :: link_def = "set arrow from -XXXXXX,-XXXXXX to -XXXXX, XXXXXX @noheads;" 
! Writing the coordinates to a string to only then call ogpf
do ...
   do ...
      write(link_def,'("set arrow from ", g0, ", ", g0, " to ", g0, ", ", g0, " @noheads;")') x, y
      call gnu % options(link_def) ! or final_string = final_string // link_def
   end do
end do
! or call gnu % options(final_string)

Or something similar, at this time I don't recall if multiple calls to options will write multiple times in the file, if not you will need a larger buffer and concatenate each set arrow.

@beddalumia
Copy link
Member Author

Ok this sounds actually nice! I'll try it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants