我已经安装了gnuplot包。
有没有办法在上面绘制 3d 表面和一些点(即我需要它在一个地方)?
表面由函数定义,点由坐标定义。
我找不到它的正常文档,也不能完全理解这个包的来源(对我来说太大太复杂了)。
我可以找到,如何分开,但我需要它在一起。而且我找不到这样做的例子。
如果有这种方式,我需要文档或示例。
请帮我解决问题。先感谢您!
*更新*
请求的代码
module Main where
import qualified Graphics.Gnuplot.Advanced as GP
import qualified Graphics.Gnuplot.MultiPlot as MultiPlot
import qualified Graphics.Gnuplot.Frame as Frame
import qualified Graphics.Gnuplot.Frame.OptionSet as Opts
import qualified Graphics.Gnuplot.Frame.OptionSet.Style as OptsStyle
import qualified Graphics.Gnuplot.Frame.OptionSet.Histogram as Histogram
import qualified Graphics.Gnuplot.Graph as Graph
import qualified Graphics.Gnuplot.Plot.ThreeDimensional as Plot3D
import qualified Graphics.Gnuplot.Graph.ThreeDimensional as Graph3D
import qualified Graphics.Gnuplot.Plot.TwoDimensional as Plot2D
import qualified Graphics.Gnuplot.Graph.TwoDimensional as Graph2D
import Graphics.Gnuplot.Plot.TwoDimensional (linearScale, )
import qualified Graphics.Gnuplot.LineSpecification as LineSpec
import qualified Data.Time as Time
--import qualified Paths_gnuplot as Path
import System.FilePath ((</>), )
import Data.Array (listArray, )
import Data.Foldable (foldMap, )
import Data.Monoid (mappend, )
list2d :: Plot2D.T Int Integer
list2d =
Plot2D.list Graph2D.listPoints [0,1,1,2,3,5,8,13::Integer]
wave3d :: Frame.T (Graph3D.T Double Double Double)
wave3d =
let meshNodes = linearScale 100 (-2,2)
in Frame.cons
(Opts.grid True $
Opts.xRange3d (-2.5,2.5) $
Opts.yRange3d (-2.5,2.5) $
defltOpts) $
Plot3D.surface
meshNodes meshNodes
(\x y -> sqrt(x*y))
defltOpts :: Graph.C graph => Opts.T graph
defltOpts =
Opts.key False $
Opts.deflt
main :: IO ()
main = sequence_ $
GP.plotDefault list2d : -- I want points like there, but in 3d, determined by coordinates list
GP.plotDefault wave3d : -- and surface like there
[]