首页 > 解决方案 > 是否可以仅将视口保存到 plplot 中的文件中?

问题描述

我只想将视口(红色边框)及其内容写入 eps 文件。那可能吗?此外,创建的 eps 文件的单位是“pt”,但我想要“mm”。

我的代码:


  use :: plplot

  implicit none

  integer(4)        :: i_dummy

  real(8)               :: xmin, xmax, ymin, ymax

  real(8), dimension(5) :: x
  real(8), dimension(5) :: y

  character(len=80)     :: output_file_name

! set name of output file
  output_file_name = 'test_output.eps'
  call plsfnam(output_file_name)

! set plot device
  call plsdev('epscairo')
  i_dummy = plsetopt('geometry','210x297')

! set background color
  call plscolbg(255,255,255)    

! init
  call plinit()     

! set environment
  xmin = 0.0d0
  xmax = 210.0d0
  ymin = 0.0d0
  ymax = 297.0d0
  call plenv( xmin, xmax, ymin, ymax, 1, -1)

  x(1) = 0.0d0
  y(1) = 0.0d0

  x(2) = 105.0d0
  y(2) = 147.0d0

  x(3) = 210.0d0
  y(3) = 297.0d0

! set colour
  call plcol0( 9 )

! set line width
  call plwidth( 2.0d0 )

! set line style
  call pllsty( 2 )

! draw lines
  call plline( x, y )

! end
  call plend()

end program test_plplot

我得到这个文件。有我想要的红色部分,但有一个白色边框,单位是“pt”:

在此处输入图像描述

标签: fortranplplot

解决方案


推荐阅读