-
Notifications
You must be signed in to change notification settings - Fork 47
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
Set output terminal from the Fortran API #41
Comments
Featuring the OGPF fpm library to interface with gnuplot. There are some inconveniences: • to my understanding the library hard-codes the output-terminal option in gnuplot, to a non-portable value, making it impossible to use with fpm... I verified that everything works as expected by a manual tweak of the OGPF source in fpm build directory > this is unacceptable > the alternative is to embed the source code in honeytools, which I would happily avoid > I submitted an issue on their github: kookma/ogpf#41 • there is no way to update the plot dynamically (a là matlab's hold on) > this may be too much to ask... We'd probably want to iterate giving a try to https://github.com/jacobwilliams/pyplot-fortran
Have you tried using the
And it changes the terminal to ASCII as expected. BTW: honeycombs you say :) can't wait to test it |
Uhm, well, apparently not for me: [...]
case ("gnuplot")
call gnu%options("set term qt;")
call gnu%xlabel('x')
call gnu%ylabel('y')
call gnu%filename("hex_temp_script.gp")
call gnu%plot(x,y,'with points pt 6 ps 1.2 lc rgb "#000000"')
[...] gives
(But editing manually the source code with the same option ( I've also tried moving around the So here we go with the metadata:
Did maybe this use to work?
|
The order is important. Be sure that this is the first thing you do. |
Never mind, I bet the issue is that in platforms where
returns anything? PS: I have no such issue because my platform supports wxWidgets, as :
|
Oh I see, the So... Is there's a way to make Anyway the generated script has the same structure as you predicted: hex_temp_script.gp# ogpf libray
# Rev. 0.22 of March 9th, 2018
# Licence: MIT
# gnuplot global setting
set term wxt size 640,480 enhanced font "verdana,10" title "ogpf libray: Rev. 0.22 of March 9th, 2018"
# ogpf extra configuration
# -------------------------------------------
# color definitions
set style line 1 lc rgb "#800000" lt 1 lw 2
set style line 2 lc rgb "#ff0000" lt 1 lw 2
set style line 3 lc rgb "#ff4500" lt 1 lw 2
set style line 4 lc rgb "#ffa500" lt 1 lw 2
set style line 5 lc rgb "#006400" lt 1 lw 2
set style line 6 lc rgb "#0000ff" lt 1 lw 2
set style line 7 lc rgb "#9400d3" lt 1 lw 2
# Axes
set border linewidth 1.15
set tics nomirror
# grid
# Add light grid to plot
set style line 102 lc rgb "#d6d7d9" lt 0 lw 1
set grid back ls 102
# plot style
set style data linespoints
# -------------------------------------------
# options
set term qt
# plot scale
# Annotation: title and labels
set xlabel "x" font ","
set ylabel "y" font ","
# axes setting
plot "-" notitle with points pt 6 ps 1.2 lc rgb "#000000"
3.3301270189221928 3.5000000000000000
2.4641016151377544 3.0000000000000004
2.4641016151377539 2.0000000000000000
3.3301270189221928 1.5000000000000000
4.1961524227066311 1.9999999999999996
4.1961524227066320 2.9999999999999991
1.5980762113533160 3.5000000000000000
0.73205080756887753 3.0000000000000004
0.73205080756887719 2.0000000000000000
1.5980762113533158 1.5000000000000000
2.4641016151377544 1.9999999999999996
2.4641016151377553 2.9999999999999991
0.73205080756887730 5.0000000000000000
-0.13397459621556129 4.5000000000000000
-0.13397459621556163 3.5000000000000000
0.73205080756887697 3.0000000000000000
1.5980762113533156 3.4999999999999996
1.5980762113533162 4.4999999999999991
1.5980762113533160 6.5000000000000000
0.73205080756887753 6.0000000000000000
0.73205080756887719 5.0000000000000000
1.5980762113533158 4.5000000000000000
2.4641016151377544 5.0000000000000000
2.4641016151377553 5.9999999999999991
3.3301270189221928 6.5000000000000000
2.4641016151377544 6.0000000000000000
2.4641016151377539 5.0000000000000000
3.3301270189221928 4.5000000000000000
4.1961524227066311 5.0000000000000000
4.1961524227066320 5.9999999999999991
4.1961524227066320 5.0000000000000000
3.3301270189221936 4.5000000000000000
3.3301270189221932 3.5000000000000000
4.1961524227066320 3.0000000000000000
5.0621778264910704 3.4999999999999996
5.0621778264910713 4.4999999999999991
e And likewise the full list of available terminals does not contain gnuplot -e "set terminal"
|
I was about to say:
This solves the issue... at least partially, can you provide a PR? |
Yeah, I agree!
Exactly, is where the "credits" go... I think this is not intended to be customizable (but you tell me) But, for the others, we might want to have all these new methods:
which would be optional to call (if not called the script is generated with the current hardcoded values). I believe this could be handled by just some extra character variables and the classic if(extra_variable/=gnuplot_term_<stuff>)then
gnuplot_term_<stuff> = extra_variable
endif Of course then, the
Yeah if you agree with the approach described here I could give it a try, it does seem quite approachable. 🙃 |
The "gnuplot" backend remains available, but "pyplot" is the new default. The output from the two backends is tuned to look fairly similar. There are options to pass a script filename and a picture filename, if the script name is not passed a default one will be produced, as we want to /always/ have a saved script, for reproducibility. If the figure name is not passed there will be no saved picture, but just a GUI popup for both backends (or something similar for peculiar cases). The "gnuplot" backend aimsˆ† to support also a custom <terminal> such as <qt>, <wxt>, <dumb> (especially useful on HPC servers), <png>, <svg>,… which instead are necessary to allow correct I/O if figure_name is given. †) Issue kookma/ogpf#41 needs to be solved... > for now I just redirect the fpm.toml pointer to a relevant "devel" branch on my personal fork ==> for now just changes the default terminal, so to allow proper testing here, but a new public API should be defined to allow the user choose. ————————————————————————————————————————————————————————————————————————— Let me brag the <dumb> terminal "gnuplot" output :) ————————————————————————————————————————————————————————————————————————— 7 +-------------------------------------------+ | | | F F | 6 |-+ F F F | | | | | 5 |-+ F F F | | | | F F F F | 4 |-+ | y | | | F F F F | | | 3 |-+ F F F | | | | | 2 |-+ F F F | | F F | | + + + + + + | 1 +-------------------------------------------+ -1 0 1 2 3 4 5 6 x —————————————————————————————————————————————————————————————————————————
I mean, I agree this is an issue but the final word here is from @kookma who has the writing permissions. That's why I suggest you open a PR so I can help reviewing and digesting the changes.
Actually, it's better include/move them in the I suggest you focus just on the |
Yes, sure, you're right.
Oh let me do some trials, cause I thought Gnuplot is able to deal with invalid parameter and just skip it (surely does with the window-title when I set the terminal to |
Yes, I can confirm that if you change the default terminal to call gnu%options("set term png;") you encounter no errors and get a correct png file. |
I just pop up to apologize for the long wait, I've been quite busy with HoneyTools itself and the PhD work it has been developed for... As summer ends I would probably keep being busy but I intend to work on this at some point. I'll let you know when there is some progress :) |
Not sure whether it will be relevant, but this is how I choose the "default terminal" for gnuplot. Create a file called set terminal qt enhanced font "Alegreya, 14" size 1600, 960 and now for all of the 2D figure my gnuplot will use qt instead of wxt. |
Do I understand correctly that the terminal option cannot be set from the Fortran client? Shouldn't
ogpf
allow the user to do that with theoptions
command?My understanding is that currently you need to directly modify the source at line:
ogpf/src/ogpf.f90
Lines 163 to 165 in 7b414be
This, in my opinion, makes unfeasible any usage through
fpm
. If your OS does not allow the hard-codedwxt
parameter you have the only option to fork the source file and manually include it in your project, which totally defeats the purpose of afpm.toml
file.The text was updated successfully, but these errors were encountered: