LewisHein/MathGL.jl - GitHub

文章推薦指數: 80 %
投票人數:10人

MathGL [http://mathgl.sourceforge.net] is a world-class open source graphics library that handles 1D, 2D, and 3D data arrays, with support for a total of over ... Skiptocontent {{message}} LewisHein / MathGL.jl Public Notifications Star 1 Fork 0 AwrapperaroundtheMathGLlibraryformathematicalandscientificplotting Viewlicense 1 star 0 forks Star Notifications Code Issues 1 Pullrequests 0 Actions Projects 0 Wiki Security Insights More Code Issues Pullrequests Actions Projects Wiki Security Insights master Branches Tags Couldnotloadbranches Nothingtoshow Loading {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default Loading 1 branch 0 tags Code Loading Latestcommit   Gitstats 25 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime src     test     .gitignore     .travis.yml     LICENSE.md     Project.toml     README.md     REQUIRE     appveyor.yml     Viewcode MathGL Documenntation HowtheplotOpStackmakesyourlifeeasier Installation InstallingtheMathGLlibrary Linux: MacOS: Windows: InstallingtheMathGLJuliapackage README.md MathGL MathGL[http://mathgl.sourceforge.net]isaworld-classopensourcegraphicslibrarythathandles1D,2D,and3Ddataarrays,withsupportforatotalofover50differenttypesofplots.Asthefollowingexcerptfromthedocumentationshows,italsohasmanyothernon-trivialfeatures,suchas: Arbitrarycurvillinearcoordinatesystems, Severaltypesoftransparencyandsmoothedlighting Vectorfontsandparsingof$\tex$symbols Vectorformat(suchasSVGandEPS)exportavailableforplots Animations Widgetstoembedinwindowingtoolkits,includingWX,FLTK,andQt MathGLalsobringsseveralkeyparadigmstoitsjobthatenableabsolutecontroloverthefinalplot.InthewordsofMathGL'sowndocumentation: Therearesixmostgeneral(base)concepts: Anypictureiscreatedinmemoryfirst.Theinternal(memory)representationcanbedifferent:bitmappicture(forSetQuality(MGL_DRAW_LMEM))orthelistofvectorprimitives(default).Afterthattheusermaydecidewhathe/shewant:savetofile,displayonthescreen,runanimation,doadditionaleditingandsoon.Thisapproachassuresahighportabilityoftheprogram–thesourcecodewillproduceexactlythesamepictureinanyOS.Anotherbigpositiveconsequenceistheabilitytocreatethepictureintheconsoleprogram(usingcommandline,withoutcreatingawindow)! Everyplotsettings(styleoflines,font,colorscheme)arespecifiedbyastring.Itprovidesconvenienceforuser/programmer–shortstringwithparametersismorecomprehensiblethanalargesetofparameters.Alsoitprovidesportability–thestringsarethesameinanyOSsothatitisnotnecessarytothinkaboutargumenttypes. Allfunctionshave“simplified”and“advanced”forms.Itisdoneforuser’sconvenience.Oneneedstospecifyonlyonedataarrayinthe“simplified”forminordertoseetheresult.Butonemaysetparametricdependenceofcoordinatesandproducerathercomplexcurvesandsurfacesinthe“advanced”form.Inbothcasestheorderoffunctionargumentsisthesame:firstdataarrays,secondthestringwithstyle,andlaterstringwithoptionsforadditionalplottuning. AlldataarraysforplottingareencapsulatedinmglData(A)class.Thisreducesthenumberoferrorswhileworkingwithmemoryandprovidesauniforminterfacefordataofdifferenttypes(mreal,doubleandsoon)orforformulaplotting. Allplotsarevectorplots.TheMathGLlibraryisintendedforhandlingscientificdatawhichhavevectornature(lines,faces,matricesandsoon).Asaresult,vectorrepresentationisusedinallcases!Inaddition,thevectorrepresentationallowsonetoscaletheploteasily–changethecanvassizebyafactorof2,andthepicturewillbeproportionallyscaled. Newdrawingneverclearsthingsdrawnalready.This,insomesense,unexpected,ideaallowstocreatealotof“combined”graphics.Forexample,tomakeasurfacewithcontourlinesoneneedstocallthefunctionforsurfaceplottingandthefunctionforcontourlinesplotting(inanyorder).Thusthespecialfunctionsformakingthis“combined”plots(asitisdoneinMatlabandsomeotherplottingsystems)aresuperfluous. (Note:sincejuliaalreadyprovidesfunctionalitysimilarto#4,thispackageusesjulia'snativearraytype) ThispackageprovidesawrapperaroundanexistingMathGLinstallationandaddsnewfeaturessuchastheplotOpStackthatallowstheusertobuildanarrayofdrawingfunctions,namethem,turnthemonandoffatwill,anddrawtheresulttoaprettypicture.SeethecommentsinMathGL.jlformoreinformationonthis. Documenntation MathGLalreadyhasgreatdocumentation;thispackagefaithfullyfollowstheMathGLC++API,withoneexeptiontomakeitmoreJulia-esque:InMathGL,eachfunctionisamethodonanmglGraphobject,sothatyoumightwriteC++codelike gr=mglGraph() gr.Plot(stuff) Injulia,thething.method()syntaxisnotsupported(withgoodreason);thustheabovecodewouldbecome gr=mglGraph() Plot(gr,stuff) Forfurtherexamplesandinformation,refertotheMathGLdocumentationandexamples.Theyshouldallworkiftranslatedaccordingtotheaboverule. HowtheplotOpStackmakesyourlifeeasier ThereisonenoteworthyfeaturethatMathGLdoesn'thave:theconceptofaplotoperationstack,orplotOpStackforshort. PartofthegeneralawesomenessofMathGLforscientificgraphicsisthatitneverdoesanythingthatitisnotexplicitlytoldto. Thisallowsforextremeflexibilityinhowyourgraphicslook,butitalsotendstocreatecodethatlookslikethis: dat=generate_some_data() gr=mglGraph() SetRange(gr,'x',size(dat,1)) SetRange(gr,'y',size(dat,2)) SetRange(gr,'z',minimum(dat),maximum(dat)) Surf(gr,data) Axis(gr) Box(gr) ratherthanlikethis: dat=generate_some_data() Surf(gr,dat) Thisisallverywell,nottosayentirelyappropriate,whenyouhaveaprogramthatgenerateslotsofsuper-customizedfigures.Itprovidestheultimatecontrol. ButitisaverydifferentstoryattheREPL.Togetaprettypicture,youhavetotypesevencommands;Ifyoumis-typenumberseven,thenyouhave tostartalloveragain.Butcondensingthesesevenoperationsintoonesimplecommand,e.g.'Surf',wouldcreatetheoppositeproblem.Youwould havetohaveatonofdifferentdefinitionsof'Surf'forhoweveryouwantedyourgraphtolook. TheplotOpStackideabringsanewapproachtothissituation.TherearetwodifferentmethodsforSurf:OnefollowstheMathGLAPIfaithfullytoenablefull controlbyyouwhenyouneedit.TheotherreturnsasetofoperationstobeperformedonanmglGraph,storedinanarrayalongwithdescriptivenamesandboolean switchestoturnthemonandoff.Thus,youcantype: #(Atthebeginningofthesession,e.g.intheuser'sjuliastartupfile) importBase.show functionshow(io::IO,ops::plotOpStack) ShowImage(draw(ops),"YourFavouriteImageViewer")) end #AttheREPL dat=generate_some_data() ops=Surf(dat)#Note:whenthefirstparameterisnotanmglGraphobject,themethodthatreturnsaplotOpStackiscalled Thentheplotwillbeshown.Ifyouwanttochangesomeoperation,youcaneasilydisableitbycallingdisable!withthenameofthe operation(inthenameselementoftheplotOpStack)and/orit'sindexinthestack. Converselyinsert!(ops,someDrawingFunction,someIndex)willaddsomeDrawingFunctiontothestackatpositionsomeIndex. Thus,youcancreategraphicsthatlookgreatbydefault,butstillhavetotalcontrolwithaminimumoftyping. Installation InstallingtheMathGLlibrary ThislibraryisonlyawrapperaroundtheMathGLlibrary;Thus,youmusthaveMathGLinstalledonyoursystembeforeitwillwork,andlibmgl2.so(orIassumelibmgl2.dllforWindowsusers)mustbepresentinyourruntimesharedlibrarypath. Linux: MathGLcanprobablybeinstalledviayourfavouriteLinuxdistro'srepository.Theseversionsmaybewayoutofdate;forinstancetheversionforubuntuis2yearsandseveralreleasesbehind.Ipersonallyrecommenddownloadingandcompilingityourself;it'snothardtodo.(Someday,IhopetohavethisdoneautomaticallywithBinDeps.) MacOS: MathGLisavailaibleviahombrew Windows: Thereisabinaryinstalleravailableathttp://mathgl.sourceforge.net. SeetheMathGLhomepage[mathgl.sourceforge.net]fordetails. InstallingtheMathGLJuliapackage Thisisassimpleas Pkg.clone("https://github.com/LewisHein/MathGL.jl") About AwrapperaroundtheMathGLlibraryformathematicalandscientificplotting Resources Readme License Viewlicense Releases Noreleasespublished Packages0 Nopackagespublished Languages Julia 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?