Giter Club home page Giter Club logo

Comments (2)

simonbyrne avatar simonbyrne commented on June 5, 2024

You need to use backticks:

julia> weval(W`Plot[x^2, {x,0,2}]`)
W"Graphics"(W"List"(W"List"(W"List"(W"List"(), W"List"(), W"Annotation"(W"List"(W"Directive"(W"Opacity"(1.0), W"RGBColor"(0.368417, 0.506779, 0.709798), W"AbsoluteThickness"(1.6)), W"Line"(W"List"(W"List"(4.081632653061224e-8, 1.6659725114535607e-15), W"List"(0.0006134358411192535, 3.7630353116968606e-7), W"List"(0.0012268308659119764, 1.5051139735543299e-6), W"List"(0.0018402258907046993, 3.3864313288199038e-6), W"List"(0.0024536209154974223, 6.020255596966409e-6), W"List"(0.0030670159402901454, 9.406586777993845e-6), W"List"(0.003680410965082868, 1.3545424871902209e-5), W"List"(0.004293805989875591, 1.8436769878691503e-5), W"List"(0.004907201014668314, 2.408062179836173e-5), W"List"(0.005520596039461038, 3.0476980630912896e-5), W"List"(0.00613399106425376, 3.762584637634498e-5), W"List"(0.006747386089046483, 4.552721903465799e-5), W"List"(0.007360781113839206, 5.418109860585194e-5), W"List"(0.007974176138631928, 6.35874850899268e-5), W"List"(0.008587571163424651, 7.374637848688262e-5), W"List"(0.009814361213010098, 9.632168601943705e-5), W"List"(0.010427756237802822, 0.00010873810015503567), W"List"(0.011041151262595545, 0.0001219070212035152), W"List"(0.01226794131218099, 0.00015050238403911705), W"List"(0.012881336336973713, 0.00016592882582623934), W"List"(0.013494731361766436, 0.0001821077745262426), W"List"(0.014721521411351881, 0.00021672319266489187), W"List"(0.015334916436144605, 0.00023515966210353796), W"List"(0.01594831146093733, 0.00025434863845506496), W"List"(0.017175101510522775, 0.0002949841118967617), W"List"(0.019628681609693666, 0.0003852851417347263), W"List"(0.020242076634486388, 0.00040974166647641977), W"List"(0.02085547165927911, 0.0004349506981309942), W"List"(0.022082261708864556, 0.0004876262821787858), W"List"(0.024535841808035447, 0.0006020075332289402), W"List"(0.02514923683282817, 0.000632484113273681), W"List"(0.025762631857620892, 0.0006637132002313029), W"List"(0.026989421907206337, 0.0007284288948851893), W"List"(0.02944300200637723, 0.0008668903671475337), W"List"(0.030056397031169954, 0.000903387002495322), W"List"(0.03066979205596268, 0.0009406361447559915), W"List"(0.031896582105548126, 0.0010173919500159729), W"List"(0.034350162204719016, 0.0011799336434905067), W"List"(0.0392573224030608, 0.0015411373622578593), W"List"(0.03992231289943356, 0.0015937910672402789), W"List"(0.04058730339580631, 0.0016473291969432303), W"List"(0.04191728438855183, 0.0017570587305107308), W"List"(0.04457724637404285, 0.0019871308942921166), W"List"(0.049897170345024916, 0.002489727608440434), W"List"(0.050562160841397676, 0.0025565321089513686), W"List"(0.051227151337770435, 0.0026242210341828353), W"List"(0.05255713233051595, 0.0027622521588073646), W"List"(0.05521709431600698, 0.0030489275047028102), W"List"(0.06053701828698904, 0.0036647305830792456), W"List"(0.0612020087833618, 0.0037456858791186953), W"List"(0.06186699927973456, 0.0038275255998786767), W"List"(0.06319698027248008, 0.003993858315560236), W"List"(0.0658569422579711, 0.00433713684356974), W"List"(0.07117686622895317, 0.005066146286174294), W"List"(0.08181671417091729, 0.006693974717725579), W"List"(0.08243763687356397, 0.006795963973297593), W"List"(0.08305855957621064, 0.006898724318874932), W"List"(0.08430040498150397, 0.007106558280045579), W"List"(0.08678409579209065, 0.007531479282450766), W"List"(0.09175147741326402, 0.008418333607516697), W"List"(0.10168624065561074, 0.010340091538670782), W"List"(0.10230716335825742, 0.010466755674413169), W"List"(0.10292808606090409, 0.010594190900160878), W"List"(0.10416993146619742, 0.010851374621672268), W"List"(0.1066536222767841, 0.011374995144758938), W"List"(0.11162100389795745, 0.012459248511187833), W"List"(0.12155576714030418, 0.014775804525067854), W"List"(0.1221645098043268, 0.01492416745573146), W"List"(0.12277325246834941, 0.015073271521657066), W"List"(0.12399073779639466, 0.015373703059294292), W"List"(0.12642570845248516, 0.015983459757712776), W"List"(0.13129564976466615, 0.017238547647125877), W"List"(0.14103553238902813, 0.019891021396256602), W"List"(0.14164427505305077, 0.0200631006553043), W"List"(0.14225301771707338, 0.020235921049613994), W"List"(0.14347050304511863, 0.020583785244019395), W"List"(0.14590547370120913, 0.021288407255974227), W"List"(0.15077541501339012, 0.022733225772460026), W"List"(0.1605152976377521, 0.025765160775736144), W"List"(0.16117563577335475, 0.025977585566945113), W"List"(0.16183597390895743, 0.02619088245106075), W"List"(0.16315665018016273, 0.026620092498011994), W"List"(0.1657980027225734, 0.027488977706794454), W"List"(0.17108070780739465, 0.029268608583879144), W"List"(0.18164611797703717, 0.03299531217612771), W"List"(0.20277693831632224, 0.041118486712941556), W"List"(0.20339320865819882, 0.041368797328277605), W"List"(0.20400947900007538, 0.041619867521882195), W"List"(0.20524201968382852, 0.04212428664389705), W"List"(0.2077071010513348, 0.04314223982714941), W"List"(0.21263726378634737, 0.045214605950544676), W"List"(0.2224975892563725, 0.049505177224897445), W"List"(0.24221824019642277, 0.058669675883851954), W"List"(0.2849616522576456, 0.08120314325740732), W"List"(0.32692554184692935, 0.10688030991190835), W"List"(0.3660690926377435, 0.13400658058462084), W"List"(0.4085147536096799, 0.1668843039167775), W"List"(0.44814007578314674, 0.20082952752292452), W"List"(0.48698587548467454, 0.23715524292157494), W"List"(0.5291337853673247, 0.27998256281715406), W"List"(0.5684613564515052, 0.32314831377868525), W"List"(0.611091037716808, 0.3734322563778052), W"List"(0.6529411965101717, 0.4263322061001346), W"List"(0.6919710165050659, 0.4788238876830542), W"List"(0.7343029466810822, 0.5392008175045202), W"List"(0.773814538058629, 0.5987889393108894), W"List"(0.816628239617298, 0.6668816817404472), W"List"(0.858662418704028, 0.7373011492946515), W"List"(0.8978762589922885, 0.8061817764619872), W"List"(0.9403922094616711, 0.8843375076162036), W"List"(0.9800878211325842, 0.9605721371324163), W"List"(1.0190039103315582, 1.0383689692710063), W"List"(1.0612221097116545, 1.126192366140855), W"List"(1.1006199702932813, 1.2113643190083834), W"List"(1.1433199410560302, 1.3071804876163644), W"List"(1.1852403893468402, 1.4047947805390493), W"List"(1.2243404988391806, 1.4990096570977736), W"List"(1.2667427185126432, 1.6046371149048015), W"List"(1.3063245993876362, 1.7064839589652683), W"List"(1.3451269577906901, 1.809366532575237), W"List"(1.3872314263748664, 1.9244110303220463), W"List"(1.426515556160573, 2.0349466319681087), W"List"(1.4691017961274018, 2.158260087384758), W"List"(1.508867697295761, 2.2766817279426124), W"List"(1.5478540759921813, 2.3958522405656093), W"List"(1.5901425648697238, 2.5285533766104638), W"List"(1.6296107149487966, 2.655631082275928), W"List"(1.6723809752089918, 2.7968581262409784), W"List"(1.714371712997248, 2.9390703703251186), W"List"(1.7535421119870345, 3.0749099385119494), W"List"(1.7960146211579433, 3.2256685194131105), W"List"(1.8356667915303824, 3.3696725695274483), W"List"(1.8745394394308825, 3.5138981099818474), W"List"(1.9167141975125048, 3.673793314946005), W"List"(1.9560686167956576, 3.826204433612877), W"List"(1.9567550440204702, 3.8288903022995524), W"List"(1.957441471245283, 3.8315771133508982), W"List"(1.9588143256949087, 3.8369535625476), W"List"(1.9615600345941595, 3.84771776931704), W"List"(1.9670514523926617, 3.86929141636008), W"List"(1.9780342879896655, 3.912619644462783), W"List"(1.9787207152144783, 3.9153356688188965), W"List"(1.979407142439291, 3.9180526355396794), W"List"(1.9807799968889164, 3.9234893960752557), W"List"(1.9835257057881674, 3.934374225522448), W"List"(1.9890171235866694, 3.956189117920988), W"List"(1.9897035508114822, 3.9589202201118203), W"List"(1.990389978036295, 3.961652264667323), W"List"(1.9917628324859205, 3.967119180872337), W"List"(1.9945085413851715, 3.9780643216584046), W"List"(1.9951949686099844, 3.9808029627665964), W"List"(1.995881395834797, 3.9835425462394576), W"List"(1.9972542502844224, 3.98902454027919), W"List"(1.9979406775092352, 3.9917669508460616), W"List"(1.998627104734048, 3.9945103037776035), W"List"(1.9993135319588609, 3.997254599073815), W"List"(1.9999999591836735, 3.9999998367346956)))), "Charting`Private`Tag\$803#1"))), W"List"()), W"List"(W"Rule"(W"DisplayFunction", W"Identity"), W"Rule"(W"Ticks", W"List"(W"Automatic", W"Automatic")), W"Rule"(W"AxesOrigin", W"List"(0, 0)), W"Rule"(W"FrameTicks", W"List"(W"List"(W"Automatic", W"Charting`ScaledFrameTicks"(W"List"(W"Identity", W"Identity"))), W"List"(W"Automatic", W"Charting`ScaledFrameTicks"(W"List"(W"Identity", W"Identity"))))), W"Rule"(W"GridLines", W"List"(W"None", W"None")), W"Rule"(W"DisplayFunction", W"Identity"), W"Rule"(W"PlotRangePadding", W"List"(W"List"(W"Scaled"(0.02), W"Scaled"(0.02)), W"List"(W"Scaled"(0.05), W"Scaled"(0.05)))), W"Rule"(W"PlotRangeClipping", W"True"), W"Rule"(W"ImagePadding", W"All"), W"Rule"(W"DisplayFunction", W"Identity"), W"Rule"(W"AspectRatio", W"Power"(W"GoldenRatio", -1)), W"Rule"(W"Axes", W"List"(W"True", W"True")), W"Rule"(W"AxesLabel", W"List"(W"None", W"None")), W"Rule"(W"AxesOrigin", W"List"(0, 0)), W"RuleDelayed"(W"DisplayFunction", W"Identity"), W"Rule"(W"Frame", W"List"(W"List"(W"False", W"False"), W"List"(W"False", W"False"))), W"Rule"(W"FrameLabel", W"List"(W"List"(W"None", W"None"), W"List"(W"None", W"None"))), W"Rule"(W"FrameTicks", W"List"(W"List"(W"Automatic", W"Automatic"), W"List"(W"Automatic", W"Automatic"))), W"Rule"(W"GridLines", W"List"(W"None", W"None")), W"Rule"(W"GridLinesStyle", W"Directive"(W"GrayLevel"(0.5, 0.4))), W"Rule"(W"Method", W"List"(W"Rule"("DefaultBoundaryStyle", W"Automatic"), W"Rule"("DefaultGraphicsInteraction", W"List"(W"Rule"("Version", 1.2), W"Rule"("TrackMousePosition", W"List"(W"True", W"False")), W"Rule"("Effects", W"List"(W"Rule"("Highlight", W"List"(W"Rule"("ratio", 2))), W"Rule"("HighlightPoint", W"List"(W"Rule"("ratio", 2))), W"Rule"("Droplines", W"List"(W"Rule"("freeformCursorMode", W"True"), W"Rule"("placement", W"List"(W"Rule"("x", "All"), W"Rule"("y", "None"))))))))), W"Rule"("DefaultMeshStyle", W"AbsolutePointSize"(6)), W"Rule"("ScalingFunctions", W"None"), W"Rule"("CoordinatesToolOptions", W"List"(W"Rule"("DisplayFunction", W"Function"(W"List"(W"Function"(W"Identity"(W"Slot"(1)))(W"Part"(W"Slot"(1), 1)), W"Function"(W"Identity"(W"Slot"(1)))(W"Part"(W"Slot"(1), 2))))), W"Rule"("CopiedValueFunction", W"Function"(W"List"(W"Function"(W"Identity"(W"Slot"(1)))(W"Part"(W"Slot"(1), 1)), W"Function"(W"Identity"(W"Slot"(1)))(W"Part"(W"Slot"(1), 2))))))))), W"Rule"(W"PlotRange", W"List"(W"List"(0, 2), W"List"(0.0, 3.9999998367346956))), W"Rule"(W"PlotRangeClipping", W"True"), W"Rule"(W"PlotRangePadding", W"List"(W"List"(W"Scaled"(0.02), W"Scaled"(0.02)), W"List"(W"Scaled"(0.02), W"Scaled"(0.02)))), W"Rule"(W"Ticks", W"List"(W"Automatic", W"Automatic"))))

This isn't much use either though. You can call W"ExportString(result, "SVG") on the result to get an image, perhaps we should have a mechanism to do that by default?

from mathlink.jl.

simonbyrne avatar simonbyrne commented on June 5, 2024

To get it to work with IJulia, you can do:

Base.Multimedia.showable(::MIME"image/svg+xml", w::MathLink.WExpr) = w.head == W"Graphics"
Base.show(io::IO, ::MIME"image/svg+xml", w::MathLink.WExpr) = Base.print(io, weval(W"ExportString"(w, "SVG")))

I wasn't able to get PNGs to work: once I figure that out I'll add a patch.

from mathlink.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.