Comments (12)
Actually, it's better include/move them in the type, public :: gpf as a member of it (since you could have multiple instances with different terminals and so on).
Yes, sure, you're right.
I suggest you focus just on the set_terminal method as you may find that not every terminal will support all parameters ("set term png" will not support a window title because there is no such thing).
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 dumb
)
from ogpf.
Yes, I can confirm that if you change the default terminal to qt
(in the source) and then
call gnu%options("set term png;")
you encounter no errors and get a correct png file.
from ogpf.
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 :)
from ogpf.
Have you tried using the options
feature? I have this project where I just:
call gp % options("set term dumb;")
And it changes the terminal to ASCII as expected.
BTW: honeycombs you say :) can't wait to test it
from ogpf.
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
Plotting neighborhood of hex a...
set term wxt size 640,480 enhanced font "verdana,10" title "ogpf libray: Rev. 0.22 of March 9th, 2018"
^
"hex_temp_script.gp" line 6: unknown or ambiguous terminal type; type just 'set terminal' for a list
(But editing manually the source code with the same option (qt
) does the trick.)
I've also tried moving around the options
command (despite I think order should not matter, as far as it comes before plot
) and nothing changed.
So here we go with the metadata:
#fpm.toml
[...]
[dependencies]
ogpf.git = "https://github.com/kookma/ogpf.git"
ogpf.branch = "master" # So I should be on master head, right?
[...]
Did maybe this use to work?
PS: I hope to roll the first minimal viable product within the weekend, keen on feedback :)
from ogpf.
The order is important. Be sure that this is the first thing you do.
Can you attatch the generated file?
from ogpf.
Never mind, I bet the issue is that in platforms where wxt
is not available (unknown) the script will halt.
Can you please check if the command
gnuplot -e "set terminal" | grep wxt
returns anything?
PS: I have no such issue because my platform supports wxWidgets, as :
$ gnuplot -e "set terminal" | grep wxt
wxt wxWidgets cross-platform interactive terminal
$ cat ogpf_temp_script.gp | grep "set term"
set term wxt size 640,480 enhanced font "verdana,10" title "ogpf libray: Rev. 0.22 of March 9th, 2018"
set term dumb
from ogpf.
Oh I see, the options
command does indeed insert the desired terminal specification, but it positions it after the default line, so that gnuplot parses wxt
anyway. Of course if wxt
is supported by the system inserting the custom line after the default leads to the correct behavior but when not recognized makes gnuplot halt.
So... Is there's a way to make options
override the first set term
line? It should be something like removing that line from subroutine create_outputfile
and calling internally options
if you detect the user has not (but I imagine parsing all options
calls would be just dumb. So maybe a new set_terminal
public method, allowing direct access to (a non parameter version of) gnuplot_term_type
?
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 wxt
:
gnuplot -e "set terminal"
Available terminal types:
cairolatex LaTeX picture environment using graphicx package and Cairo backend
canvas HTML Canvas object
cgm Computer Graphics Metafile
context ConTeXt with MetaFun (for PDF documents)
domterm DomTerm terminal emulator with embedded SVG
dumb ascii art for anything that prints text
dxf dxf-file for AutoCad (default size 120x80)
emf Enhanced Metafile format
epscairo eps terminal based on cairo
epslatex LaTeX picture environment using graphicx package
fig FIG graphics language V3.2 for XFIG graphics editor
gif GIF images using libgd and TrueType fonts
hpgl HP7475 and relatives [number of pens] [eject]
jpeg JPEG images using libgd and TrueType fonts
lua Lua generic terminal driver
mf Metafont plotting standard
mp MetaPost plotting standard
pcl5 PCL5e/PCL5c printers using HP-GL/2
pdfcairo pdf terminal based on cairo
pict2e LaTeX2e picture environment
png PNG images using libgd and TrueType fonts
Press return for more:
pngcairo png terminal based on cairo
postscript PostScript graphics, including EPSF embedded files (*.eps)
pslatex LaTeX picture environment with PostScript \specials
pstex plain TeX with PostScript \specials
pstricks LaTeX picture environment with PSTricks macros
qt Qt cross-platform interactive terminal
sixelgd sixel using libgd and TrueType fonts
svg W3C Scalable Vector Graphics
tek40xx Tektronix 4010 and others; most TEK emulators
tek410x Tektronix 4106, 4107, 4109 and 420X terminals
texdraw LaTeX texdraw environment
tikz TeX TikZ graphics macros via the lua script driver
tkcanvas Tk canvas widget
unknown Unknown terminal type - not a plotting device
vttek VT-like tek40xx terminal emulator
xterm Xterm Tektronix 4014 Mode
from ogpf.
I was about to say:
Indeed assuming a default term is a problem, a possible fix would just creating a method to handle it, let's say:
call gp % set_terminal("qt") ! I like this one the most call gp % term("qt") call gp % set_term("qt") call gp % terminal("qt")create a character variable here
Lines 207 to 209 in 7b414be
But this requires changing it here as well (where the writing is done)
Lines 2201 to 2204 in 7b414be
The only big problem left is figuring out all where to put all the other configs like font, size, title (I guess it's the window title) for each terminal, figuring this out is no easy task, but it may not be needed.
It can be accomplished by just checking if, let's say
this % txtterminal
, is allocated and then just outputting its contents in the writing section, or writting the default way with wxt otherwise.
This solves the issue... at least partially, can you provide a PR?
from ogpf.
call gp % set_terminal("qt") ! I like this one the most
Yeah, I agree!
title (I guess it's the window title)
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:
-
set_terminal
-
set_font
-
set_size
-
set_window_title
(?)
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 gnuplot_term_<stuff>
variables need to give up the parameter
attribute, but I don't see big issues with this.
This solves the issue... at least partially, can you provide a PR?
Yeah if you agree with the approach described here I could give it a try, it does seem quite approachable. 🙃
from ogpf.
Yeah if you agree with the approach described here
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.
Of course then, the gnuplot_term_ variables need to give up the parameter attribute
Actually, it's better include/move them in the type, public :: gpf
as a member of it (since you could have multiple instances with different terminals and so on).
I suggest you focus just on the set_terminal
method as you may find that not every terminal will support all parameters ("set term png" will not support a window title because there is no such thing).
from ogpf.
Not sure whether it will be relevant, but this is how I choose the "default terminal" for gnuplot.
Create a file called .gnuplot
under the $HOME
directory, and add
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.
from ogpf.
Related Issues (20)
- Errorbars HOT 1
- Is there a way to plot 2d heatmap? HOT 3
- The example fails on macOS HOT 16
- [gnuplot in windows 10] the command 'gnuplot -persist' will make the cpu fully loaded HOT 2
- Animation Pause HOT 1
- Question HOT 7
- Question HOT 2
- Plotting points with color scale HOT 1
- Is it possible to add options after calling a plot subroutine? HOT 2
- Use data blocks to in-line data in the script HOT 4
- Is that possible to use that in Visual Studio IDE using intel compiler? HOT 2
- The documentation websit elink is broken. HOT 2
- add optional wait = .false. to call execute_command_line ('wgnuplot -persist ' // this%txtfilename) HOT 13
- Failing Examples HOT 4
- Debug ogpf and its demo in cbfortran. HOT 3
- Possibility of using custom palette HOT 9
- unused variables HOT 2
- typo HOT 1
- use real(x, kind=wp) instead of dble(x) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ogpf.