3D graphics
5 posts
• Page 1 of 1
3D graphics
Is there a way in Dyalog to make a surface plot or wire mesh plot?
- Stu
- Posts: 97
- Joined: Thu Dec 31, 2015 1:30 am
Re: 3D graphics
Sure. Try the following:
And then open /tmp/surface.svg. Try it online!
You can also customise every aspect of the chart:
⎕USING←',system.dll' ',system.drawing.dll' ',sharpplot.dll'
→0/⍨⎕NC'Causeway' ⋄ (System.Drawing←System←Causeway←⎕NS ⍬).⎕CY'sharpplot.dws'
∆sharpplot←⎕NEW Causeway.SharpPlot
∆sharpplot.DrawResponsePlot((⍳100)×↓|1○(0.002×⍳100)∘.×⍳100)⍬ ⍬
∆sharpplot.SaveSvg⊂'/tmp/surface.svg'
And then open /tmp/surface.svg. Try it online!
You can also customise every aspect of the chart:
Surface;Causeway;System;∆sharpplot
⎕USING←',system.dll' ',system.drawing.dll' ',sharpplot.dll'
:If 0≠⎕NC'Causeway'
(System.Drawing←System←Causeway←⎕NS ⍬).⎕CY'sharpplot.dws'
:EndIf
∆sharpplot←⎕NEW Causeway.SharpPlot
∆sharpplot.SetBackground System.Drawing.Color.Black Causeway.FillStyle.Sunrise 0
∆sharpplot.SetAltitudeColors⊂System.Drawing.Color.(Purple Turquoise Orange)
∆sharpplot.SetAxisStyle System.Drawing.Color.White Causeway.LineStyle.Solid 1.2
∆sharpplot.SetFillStyles⊂,Causeway.FillStyle.Opacity78
∆sharpplot.SetFootnoteFont'Arial' 8 System.Drawing.FontStyle.Regular System.Drawing.Color.White
∆sharpplot.FootnoteStyle←Causeway.FootnoteStyles.RuledAbove
∆sharpplot.Footnote←'Data is an [X;Y] matrix of Z altitudes.'
∆sharpplot.SetHeadingFont'Times New Roman' 16 System.Drawing.FontStyle.Regular System.Drawing.Color.White
∆sharpplot.Heading←'3D Response Surface'
∆sharpplot.SetLabelFont'Times New Roman' 8 System.Drawing.FontStyle.Regular System.Drawing.Color.White
∆sharpplot.SetMargins 50 30 30 ¯50
∆sharpplot.ResponsePlotStyle←Causeway.ResponsePlotStyles.(NoLines+AltitudeShading+ScaleBar)
∆sharpplot.SetSubheadingFont'Times New Roman' 12 System.Drawing.FontStyle.Regular System.Drawing.Color.White
∆sharpplot.Subheading←'a response plot with altitude shading and perspective'
∆sharpplot.XAxisStyle←Causeway.XAxisStyles.(GridLines+AngledLabels)
∆sharpplot.YAxisStyle←Causeway.YAxisStyles.(GridLines+AngledLabels)
∆sharpplot.ZAxisStyle←Causeway.ZAxisStyles.GridLines
∆sharpplot.DrawResponsePlot((⍳100)×↓|1○(0.002×⍳100)∘.×⍳100)⍬ ⍬
∆sharpplot.SaveSvg⊂'/tmp/surface.svg'
-
Adam|Dyalog - Posts: 135
- Joined: Thu Jun 25, 2015 1:13 pm
Re: 3D graphics
I need some help with this. I tried running the shorter code segment at the top of your post but I got FILE NAME ERROR on file "/tmp/surface.svg". I'm running on Windows but that looks like a Linux/Unix pathname.
⎕USING←',system.dll' ',system.drawing.dll' ',sharpplot.dll'
→0/⍨⎕NC'Causeway' ⋄ (System.Drawing←System←Causeway←⎕NS ⍬).⎕CY'sharpplot.dws'
∆sharpplot←⎕NEW Causeway.SharpPlot
∆sharpplot.DrawResponsePlot((⍳100)×↓|1○(0.002×⍳100)∘.×⍳100)⍬ ⍬
∆sharpplot.SaveSvg⊂'/tmp/surface.svg'
Thanks for your help.
⎕USING←',system.dll' ',system.drawing.dll' ',sharpplot.dll'
→0/⍨⎕NC'Causeway' ⋄ (System.Drawing←System←Causeway←⎕NS ⍬).⎕CY'sharpplot.dws'
∆sharpplot←⎕NEW Causeway.SharpPlot
∆sharpplot.DrawResponsePlot((⍳100)×↓|1○(0.002×⍳100)∘.×⍳100)⍬ ⍬
∆sharpplot.SaveSvg⊂'/tmp/surface.svg'
Thanks for your help.
- Stu
- Posts: 97
- Joined: Thu Dec 31, 2015 1:30 am
Re: 3D graphics
Windows generally accepts / in place of \ except for certain things on the command line.
I suspect you just don't have a folder called C:\tmp.
Now that I know that you are on Windows, try also:
I suspect you just don't have a folder called C:\tmp.
Now that I know that you are on Windows, try also:
]chart (⍳100)×↓|1○(0.002×⍳100)∘.×⍳100
-
Adam|Dyalog - Posts: 135
- Joined: Thu Jun 25, 2015 1:13 pm
Re: 3D graphics
Very interesting! This definitely looks like something I can work with. Thanks.
- Stu
- Posts: 97
- Joined: Thu Dec 31, 2015 1:30 am
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group