Creating (scientific) plots via gnuplot

User projects written in or related to FreeBASIC.
aurelVZAB
Posts: 289
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby aurelVZAB » May 20, 2019 19:09

JJ
just use mediafire link and download zip pack into FB examples folder
Unzip package.
Then i use Jose Roca CSED-FB version ( i changed SciLexer to 3.7.4.0)
and open examples from new Dslin folder.
then in Csed- compile....wait
Run..wait..
and work on my win7 machine
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Creating (scientific) plots via gnuplot

Postby dodicat » May 20, 2019 19:48

You can unpack the dislin folder on the desktop.
Put my above snippet into the dislin folder and run it.
Then test the other examples.
No sense in going anywhere near the fb distribution folders unless you want to perhaps keep hold of dislin, then pop the folder somewhere you know, as suggested, perhaps the FB examples folder.
I presume your ide can pick up and run a .bas file from any location.
jj2007
Posts: 1214
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby jj2007 » May 20, 2019 20:11

Thank you all for your attempts to help me, but I am out. Most of these "additional" packages suffer from the same problems: they require environment variables to be set, specific folders, specific IDEs, no installation instructions, and conflicting advice from people who managed to get them running through hours of trial and error. I have never seen a BASIC dialect that was so confused, sorry...
TJF
Posts: 3481
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Creating (scientific) plots via gnuplot

Postby TJF » May 20, 2019 20:36

Carlos Herrera wrote:BTW, it was me who told Helmut Michels (dislin author) about the existence of FB.
... and you told him about the existence of my bindings/examples. Now Helmut is happy! He ships the source code of translated examples and bindings for a further programming language. But unfortunately he does not ship the original copyright messages. Poor style :-(

aurelVZAB wrote:hi dodicat,jj,tjf...all

I would like to see this plotting using fbgx better than those external libs.
That's why I pointed you to a clean fbgfx solution by
TJF wrote:Perhaps a simple X / Y regression analysis may meet your needs?
Of course, it's up to you to replace the gray scaling by a coloured scaling to meet your needs.

Regards
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Creating (scientific) plots via gnuplot

Postby dodicat » May 20, 2019 20:46

jj2007
Perhaps your ide!
Here is a windows quickrunner.
Compile to .exe.
click the .exe.
Find your compiler via select compiler.
For the dislin examples get a 32 bit fb compiler.
Open, navigate to the dislin folder and choose an example (say curve.bas)
press compile then run (the compile run is in effect a quick run mode).
You can set some optimisations in the build options.

Code: Select all


'quickrunner.bas
#define WIN_INCLUDEALL
#Include Once "windows.bi"
#Include once "/win/commctrl.bi"
#include "file.bi"
shell "title Compiler output"
'shell "color f0"
Dim Shared As String fbpath,s1,cd,cpy,L,original,content
dim shared as long filechanged,cleanend
cd=Curdir
Declare Function SetWindowTheme Lib "UxTheme.dll" Alias "SetWindowTheme"(As Any Ptr,As zstring Ptr,As zstring Ptr) As Long
Declare Sub getfiles(Byref SomeFile As OpenFileName,msg As String,flag As String)
Declare Sub CreateMessageWindow
Declare Function loadfile(file As String,flag As Long=1) As String
Declare Sub savefile(filename As String,p As String)
Declare Function getclipboard() As String
declare Function CreateToolTip(X As hwnd,msg As String="") As hwnd
' Globals (unavoidable)
Dim Shared As HFONT guiFont
Dim Shared As zString * 255 textMessage=""
textmessage=loadfile("Buildoptions.txt")
Dim As String tmp
savefile(cd+"\Clipboard.txt","")
fbpath=loadfile("CompilerPath.txt",0)

Dim Shared As Long flag
Dim Shared As HWND  MainWindow, MessageWindow,btn,btn2,runbut,compiler
Dim Shared As HWND EditBox, Button,msgon,label,bar2,label2,minilabel,clabel,file,clipboard
Dim Shared As Long trackpos
Dim Shared SomeFile As OpenFileName
Function WndProc(hWnd As HWND, msg As UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
   
    Select Case hWnd
   
    Case MainWindow 
        Select Case msg
       
        Case WM_PAINT
            Dim As PAINTSTRUCT ps
            BeginPaint(hWnd, @ps)
            FillRect(ps.hdc, @ps.rcPaint, CreateSolidBrush(BGR(100,100,255)))
            EndPaint(hWnd, @ps)
           
        Case WM_CLOSE
            Kill   cd+"/buildoptionsTEMP.exe"
            Kill   cd+"/BuildoptionsTEMP.bas"
            Kill   cd+"/Clipboard.txt"
            if filechanged then
            var answer=messagebox(0,"Has changed,save?",cpy,MB_YESNO)
            if answer=IDYES then:end if
            if answer=IDNO then
               savefile(original,content)
            end if
            end if
            cleanend=1
            PostQuitMessage(NULL)
           
        Case WM_COMMAND
            Select Case lParam 
            Case msgon
                CreateMessageWindow
               
            Case clipboard
                L=getclipboard
                savefile("Clipboard.txt",L)
                cpy="clipboard.txt"
                setwindowtext(file,"File" +Chr(13,10)+cpy)
                Goto label
               
            Case btn 'open
                filechanged=0
                getfiles(SomeFile, "FreeBASIC Files","*.bas")
                s1=*SomeFile.lpstrFile
                cpy=s1
                original=s1
             
                setwindowtext(file,"File" +Chr(13,10)+cpy)
                L=loadfile(s1,3)
                content=L
                label:
                savefile(cd +"/BuildoptionsTEMP.bas",L)
                s1=cd+"/BuildoptionsTEMP.bas"
                ShellExecute (0,"","notepad.exe ",cpy,"",SW_SHOWNORMAL)
               
            Case btn2'compile
                If Len(s1) Then
                    textmessage=loadfile(cd+"\Buildoptions.txt",3)
                    s1=" "+cd+"/BuildoptionsTEMP.bas"
                    s1+=" "+textmessage+" "
                    var tst1=loadfile(cpy,3)
                    var tst2=loadfile(cd +"/BuildoptionsTEMP.bas",3)
                    if tst1<>tst2 then
                        filechanged=1
                       
                        savefile(cd+"/BuildoptionsTEMP.bas",tst1)
                       
                        end if
                 
                    Dim As String tm="Command "+Chr(13,10)+fbpath+Chr(13,10)+s1
                    setwindowtext(clabel,tm)
                 
                    Shell   fbpath+s1
                   
                Else
                    messagebox(0,"No file chosen","",0)
                End If
            Case runbut
               
                Dim As String tm="Command "+Chr(13,10)+cd+"/buildoptionsTEMP.exe"
                setwindowtext(clabel,tm)
               
                If Fileexists (  cd+"/buildoptionsTEMP.exe")  Then
                    ShellExecute (0,"", cd+"/buildoptionsTEMP.exe","","",SW_SHOWNORMAL)
                End If
               
            Case compiler'select a compiler
                getfiles(SomeFile, "Fbc.exe","fbc*.exe")
                s1=*SomeFile.lpstrFile
                if instr(s1," ") then s1=chr(34)+s1+chr(34) '''''''''''''''
       
                savefile(cd+"/CompilerPath.txt",s1)
             
                fbpath=loadfile(cd +"/CompilerPath.txt",3)
             
               
                setwindowtext(label, fbpath)
               
            End Select
           
        End Select
       
    Case MessageWindow 
        Select Case msg
        Case WM_COMMAND
            Select Case lParam 
            Case Button   
                GetWindowText(EditBox, @textMessage, 255)
                flag=0
                savefile(cd+"\buildoptions.txt",textmessage)
                destroywindow(messagewindow)
            End Select
           
        Case WM_CLOSE
            flag=0
        End Select
       
    End Select
   
    Return DefWindowProc(hWnd, msg, wParam, lParam)
End Function


' Create  window class:
Dim As WNDCLASS wcls

With wcls
   
    .style      = CS_HREDRAW Or CS_VREDRAW or CS_DROPSHADOW'
    .lpfnWndProc  = Cast(WNDPROC, @WndProc)
    .hInstance    = GetModuleHandle(NULL)
    .hIcon      = LoadIcon(NULL, IDI_APPLICATION)
    .hCursor      = LoadCursor(NULL, IDC_ARROW)
    .hbrBackground  = GetStockObject(WHITE_BRUSH)
    .lpszMenuName  = NULL
    .lpszClassName  = Strptr("WindowClass")
End With

If RegisterClass(@wcls) = FALSE Then
    MessageBox(NULL, "RegisterClass('WindowClass') FAIL!", "Error!", MB_OK Or MB_ICONERROR)
    End
End If


MainWindow = CreateWindowEx(NULL, "WindowClass", "Flag setter", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 650, 500, NULL, NULL, NULL, NULL)
msgon= CreateWindowEx(NULL, "Button", "Build options", WS_VISIBLE Or WS_CHILD , 10, 40, 90, 24, MainWindow, NULL, NULL, NULL)
btn=CreateWindowEx( 0,"BUTTON","Open", ws_border Or WS_VISIBLE Or WS_CHILD ,150,50,100,30,  MainWindow,0,0,0)
btn2  =createwindowex(0,"BUTTON","Compile"  ,ws_border Or WS_VISIBLE Or WS_CHILD,280,50,120,30,MainWindow,0,0,0)
runbut=createwindowex(0,"BUTTON","Run"  ,ws_border Or WS_VISIBLE Or WS_CHILD,430,50,120,30,MainWindow,0,0,0)
compiler=createwindowex(0,"BUTTON","Select Compiler"  ,ws_border Or WS_VISIBLE Or WS_CHILD,230,150,120,30,MainWindow,0,0,0)
label=createwindowex(0,"STATIC",fbpath , WS_VISIBLE Or WS_CHILD,0,200,600,60,MainWindow,0,0,0)
minilabel=Createwindowex(0,"STATIC","Compiler:"  ,WS_VISIBLE Or WS_CHILD,0,170,100,30,MainWindow,0,0,0)
clabel=createwindowex(0,"STATIC","Command " , WS_VISIBLE Or WS_CHILD,0,280,600,80,MainWindow,0,0,0)
file=createwindowex(0,"STATIC","File" , WS_VISIBLE Or WS_CHILD,0,380,600,60,MainWindow,0,0,0)
clipboard=CreateWindowEx( 0,"BUTTON","Clipboard", ws_border Or WS_VISIBLE Or WS_CHILD ,150,100,100,30,  MainWindow,0,0,0)

SetWindowTheme(mainwindow," "," ")
Sub CreateMessageWindow
    If flag=0 Then
        flag=1
        MessageWindow = CreateWindowEx(NULL, "WindowClass", "Options", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 300, 150, NULL, NULL, NULL, NULL)
        EditBox = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", textmessage, WS_VISIBLE Or WS_CHILD Or WS_HSCROLL  Or ES_AUTOHSCROLL Or ES_MULTILINE, 10, 0, 250, 50, MessageWindow, NULL, NULL, NULL)
        Button = CreateWindowEx(NULL, "Button", "Save", WS_VISIBLE Or WS_CHILD, 10, 70, 200, 24, MessageWindow, NULL, NULL, NULL)
       
        SetWindowTheme(messagewindow," "," ")'  optional
        createtooltip(EditBox,"-gen gcc -Wc -O3")
    End If
End Sub
Sub getfiles(Byref SomeFile As OpenFileName,msg As String,flag As String)
    Dim As zstring * 2048 SELFILE
    Dim As String MYFILTER
    MYFILTER = msg+Chr(0)+flag+Chr(0)
    With SomeFile
        .lStructSize = Sizeof(OpenFileName)
        .hInstance = null
        .lpstrFilter = Strptr(MYFILTER)
        .lpstrFile = @SELFILE
        .nMaxFile = 2048
        .nMaxFileTitle = 0
        .lpstrTitle =@"Open"
    End With
    GetOpenFileName(@SomeFile)
End Sub
Function loadfile(file As String,flag As Long=1) As String
    If flag=1 Then
        If Fileexists("Buildoptions.txt")=0 Then savefile("Buildoptions.txt","")
    End If
    If flag=0 Then
        If Fileexists("CompilerPath.txt")=0 Then savefile("CompilerPath.txt","")
    End If
    Var  f=Freefile
    Open file For Binary Access Read As #f
    Dim As String text
    If Lof(1) > 0 Then
        text = String(Lof(f), 0)
        Get #f, , text
    End If
    Close #f
    Return text
End Function

Sub savefile(filename As String,p As String)
    Dim As Integer n
    n=Freefile
    If Open (filename For Binary Access Write As #n)=0 Then
        Put #n,,p
        Close
    Else
        Print "Unable to save " + filename
    End If
End Sub
Function getclipboard() As String
    If IsClipboardFormatAvailable(CF_TEXT) = 0 Then Return "Error"
    If OpenClipboard(0) = 0 Then Return "Error"
    Function = *Cast(zstring Ptr,GetClipboardData(CF_TEXT))
    CloseClipboard()
End Function

Function CreateToolTip(X As hwnd,msg As String="") As hwnd
    Dim As hwnd  TT= CreateWindowEx(0,"ToolTips_Class32","",64,0,0,0,0,X,0,GetModuleHandle(0),0)
                                                           '64=bubble,0 = rectangle
    SendMessage(TT, TTM_SETMAXTIPWIDTH, 0 , 280)
    SendMessage(TT, TTM_SETDELAYTIME, TTDT_INITIAL ,40)
    SendMessage(TT, TTM_SETDELAYTIME, TTDT_RESHOW  ,60)
    Dim bubble As TOOLINFO
    bubble.cbSize = Len(TOOLINFO)
    bubble.uFlags = TTF_IDISHWND Or TTF_SUBCLASS
    bubble.uId = Cast(Uinteger,X)
    bubble.lpszText = Strptr(msg)
    SendMessage(TT, TTM_ADDTOOL, 0,Cast(LPARAM,@bubble))
    Return TT
End Function

Sub cleanup Destructor
    Kill   cd+"/buildoptionsTEMP.exe"
    Kill   cd+"/BuildoptionsTEMP.bas"
    Kill   cd+"/Clipboard.txt"
End Sub


Dim As MSG uMsg

While GetMessage(@uMsg, NULL, NULL, NULL) <> FALSE
    TranslateMessage(@uMsg)
    DispatchMessage(@uMsg)
Wend


   

(This is a last ditch stand to get you a runner)
jj2007
Posts: 1214
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby jj2007 » May 21, 2019 1:23

@dodicat: Thanks, I got your program running after a while using WinFBE, but it fails on the DisLin examples. Same crappy error list as above. All my other stuff works just fine - for example, this Windows template:

Code: Select all

#Include "windows.bi"
Dim Shared as Handle hEdit
Function WndProc(hWnd As HWND, msg As  UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
  Dim As RECT rc
  Dim As PAINTSTRUCT ps
  Dim As HANDLE PtDC
  Select Case msg
  Case WM_CREATE
   hEdit=CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "Hello, I am an edit control",_
   WS_CHILD Or WS_VISIBLE or ES_MULTILINE, 0, 0, 100, 100, hWnd, 100, 0, 0)
  Case WM_PAINT
   PtDC=BeginPaint(hWnd, @ps)
   TextOut(PtDC, 3, 3, "TextOut in the WM_PAINT handler", 31)
   EndPaint(hWnd, @ps)
  Case WM_KEYDOWN
     if wParam=VK_ESCAPE then SendMessage(hWnd, WM_CLOSE, 0, 0)
  Case WM_SIZE
   GetClientRect(hWnd, @rc)
   MoveWindow(hEdit, 3, 23, rc.right-6, rc.bottom-26, 0)
  Case WM_DESTROY
      PostQuitMessage(0)
  End Select
  return DefWindowProc(hwnd, msg, wParam, lParam)
End Function

Function WinMain(hInstance As HINSTANCE, hPrevInstance As HINSTANCE, lpCmdLine As LPSTR, nShowCmd As Integer) As Integer
   Dim As WNDCLASSEX wc
   Dim As MSG msg
   Dim As string classname="FbGui"
   wc.cbSize = sizeof(WNDCLASSEX)
   wc.hbrBackground = COLOR_BTNFACE+1
   wc.hCursor = LoadCursor(0, IDC_ARROW)
   wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION)
   wc.hIconSm = wc.hIcon
   wc.hInstance = hInstance
   wc.lpfnWndProc = @WndProc
   wc.lpszClassName = StrPtr(classname)
   wc.style = CS_HREDRAW Or CS_VREDRAW
   RegisterClassEx(@wc)

   if CreateWindowEx(0, wc.lpszClassName, "Hello World",_
   WS_OVERLAPPEDWINDOW Or WS_VISIBLE, (GetSystemMetrics(SM_CXSCREEN) / 2) - 150,_
   (GetSystemMetrics(SM_CYSCREEN) / 2) - 150, 300, 300, 0, 0, hInstance, 0)=0 then
          MessageBox(0, "Creating hMain failed miserably", 0, MB_OK)
          return 0
   End If

   While GetMessage(@msg, 0, 0, 0)
      TranslateMessage(@msg)
      DispatchMessage(@msg)
   Wend

   return msg.wParam
End Function
WinMain(GetModuleHandle(NULL), NULL, COMMAND(), SW_NORMAL)

Btw I found out a strange behaviour of WinFBE: If you open an existing source, e.g. the window template above, then paste another code, e.g. your example, then press F5 to compile it, then close the window, it will overwrite the old source without any warning. Really dangerous.
srvaldez
Posts: 2063
Joined: Sep 25, 2005 21:54

Re: Creating (scientific) plots via gnuplot

Postby srvaldez » May 21, 2019 1:35

in dislin.bi inclib probably was including the wrong or missing lib
btw, this thread has gone way off topic, one reason I have not participated, even this post is off topic.
Last edited by srvaldez on May 21, 2019 1:56, edited 2 times in total.
jj2007
Posts: 1214
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby jj2007 » May 21, 2019 1:46

Trial and error and a sleepless night are the solution to all problems, hooray!
Dodicat's original version (error 132: Too many errors, exiting):

Code: Select all

#INCLUDE "dislin.bi"

dim as double current(...) = {120, 125, 122, 119, 134, 138, 141, 159, 162, 178}
dim as double voltage(...) = {250, 210, 180, 155, 140, 125, 110, 100, 90, 80}

metafl ("cons")
disini()
pagera()
complx()
axspos(450,1700)
axslen(2200,1200)

name_("Current [A]","x")
name_("Voltage [V]","y")

labdig(-1,"x")
ticks(5,"x")
ticks(5,"y")

titlin("Voltage over Current",2)

var ic=intrgb(0.95,0.95,0.95)
axsbgd(ic)

graf(100.,200.,100.,10.,0.,300.,0.,50.)
setrgb(0.7,0.7,0.7)
grid(1,1)

color_("fore")
height(60)
title()

color_("blue")
for n as long=0 to 8
    rline(current(n),voltage(n),current(n+1),voltage(n+1))
next

disfin()

Some minor changes applied (compiles and runs just fine):

Code: Select all

#INCLUDE "dislin.bi"

dim as double current(...) = {120, 125, 122, 119, 134, 138, 141, 159, 162, 178}
dim as double voltage(...) = {250, 210, 180, 155, 140, 125, 110, 100, 90, 80}

Dislin.metafl ("cons")
Dislin.disini()
Dislin.pagera()
Dislin.complx()
Dislin.axspos(450,1700)
Dislin.axslen(2200,1200)

Dislin.name("Current [A]","x")
Dislin.name("Voltage [V]","y")

Dislin.labdig(-1,"x")
Dislin.ticks(5,"x")
Dislin.ticks(5,"y")

Dislin.titlin("Voltage over Current",2)

var ic=Dislin.intrgb(0.95,0.95,0.95)
Dislin.axsbgd(ic)

Dislin.graf(100.,200.,100.,10.,0.,300.,0.,50.)
Dislin.setrgb(0.7,0.7,0.7)
Dislin.grid(1,1)

Dislin.color("fore")
Dislin.height(60)
Dislin.title()

Dislin.color("blue")
for n as long=0 to 8
    Dislin.rline(current(n),voltage(n),current(n+1),voltage(n+1))
next

Dislin.disfin()

So it was basically a namespace problem. Plus, it didn't like name_ (with understroke). Now the interesting question is why dodicat's code compiles and runs fine on dodicat's computer ;-)
aurelVZAB
Posts: 289
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby aurelVZAB » May 21, 2019 6:56

hey JJ
i am wondering why not work on your computer?
i use FB 1.05.0-win32 with jose CSED_FB.
Well this dislin is not bad but is not what i show in the post above .
look screenshot
Image
Last edited by aurelVZAB on May 21, 2019 9:18, edited 3 times in total.
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Creating (scientific) plots via gnuplot

Postby dodicat » May 21, 2019 8:18

jj2007
with your code
If I put

namespace dislin
#INCLUDE "dislin.bi"
end namespace

and put the underscores back on name and color

your code runs fine.

So what is going on with this namespace and underscore issue?


Your windows template also works with a couple of warnings.
Passing scalar as pointer, at parameter 10 of CREATEWINDOWEX()
and
Suspicious pointer assignment.

For freebasic I use the simplest of ides (fbide)
And I would use the quickrunner to test optimizing in gcc because fbide will not accept uppercase on the command flags (-O3)
But I did also test running some dislin examples straight from the dislin folder with WinFBE and found no hiccups.

Win 10 32 bit fbc 1.06.0 for the dislin examples.


aurielVZAB
what is jose CSED_FB ?
I cannot see your screenshot, only an icon saying image.
aurelVZAB
Posts: 289
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby aurelVZAB » May 21, 2019 9:14

what is jose CSED_FB ?
I cannot see your screenshot, only an icon saying image.


It is well known Jose Roca CSED editor for FB
It is simple and good !i like it...

You cannot see screenshot ..well then something is disabled in your browser?
Yes ..what a crap Vivaldi(chrome) not show image , but K-Meleon (gecko) show.
So Firefox should show too..
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Creating (scientific) plots via gnuplot

Postby dodicat » May 21, 2019 9:40

I cannot see the screenshot on Chrome or Firefox or Internet explorer.
My microsoft edge is not working, but it no great loss.
I tried my other machine with Linux Firefox, but there is no screenshot.
I think it is just one of those days to try the lottery.
jj2007
Posts: 1214
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby jj2007 » May 21, 2019 10:05

dodicat wrote:jj2007
with your code
If I put

namespace dislin
#INCLUDE "dislin.bi"
end namespace

and put the underscores back on name and color

your code runs fine.

So what is going on with this namespace and underscore issue?

I have no idea. Fact is that
- it compiles and runs fine with the Dislin.metafl ("cons") etc syntax, and without underscores for color and name
- it doesn't compile with the namespace thing you mention above: with or without Dislin., you get the full error list as above

Besides, given that you didn't include namespace in your original post, I guess that it compiled on your machine without that addition, right?

The plot itself looks fine, although the font looks a bit odd, and the window is not sizeable.Image
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Creating (scientific) plots via gnuplot

Postby dodicat » May 21, 2019 11:19

jj2007
My origional code runs without any namespace.
I suppose it is a nice idea to put #include "dislin.bi" within a namespace and pluck out only the functions needed.
Regarding the scaling of the graph, looks like you can
axslen(2200-500,1200)
To shorten the x domain a little.
The font heights can be changed anywhere it seems.
Here are some of the fonts for windows

Code: Select all

namespace dislin
#INCLUDE "dislin.bi"
end namespace

dim as double current(...) = {120, 125, 122, 119, 134, 138, 141, 159, 162, 178}
dim as double voltage(...) = {250, 210, 180, 155, 140, 125, 110, 100, 90, 80}


dislin.page (2970,2100) 'default
Dislin.metafl ("cons")
Dislin.disini()
Dislin.pagera()

'dislin.disalf
'dislin.simplx
'dislin.duplx
'dislin.triplx
dislin.gothic
'dislin.helve
'dislin.helves
'Dislin.serif
'dislin.complx

Dislin.axspos(450,1700)
Dislin.axslen(2200-500,1200)

Dislin.name_("Current [A]","x")
Dislin.name_("Voltage [V]","y")

Dislin.labdig(-1,"x")
Dislin.ticks(5,"x")
Dislin.ticks(5,"y")

Dislin.titlin("Voltage over Current",2)

var ic=Dislin.intrgb(0.95,0.95,0.95)
Dislin.axsbgd(ic)
Dislin.height(40) '
Dislin.graf(100.,200.,100.,10.,0.,300.,0.,50.)
Dislin.setrgb(0.7,0.7,0.7)
Dislin.grid(1,1)

Dislin.color_("fore")
Dislin.height(60)
Dislin.title()

Dislin.color_("blue")
for n as long=0 to 8
    Dislin.rline(current(n),voltage(n),current(n+1),voltage(n+1))
next

Dislin.disfin()

But I think the Gothic fonts were invented before electricity.

some info for dislin:
https://www2.mps.mpg.de/dislin/kap6.html#CHACOD
aurelVZAB
Posts: 289
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Creating (scientific) plots via gnuplot

Postby aurelVZAB » May 21, 2019 12:41

My microsoft edge is not working

hmm then i suspect something is wrong with your windows 10

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest