爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 61|回复: 0

[作图] eps文件无法在AI中打开

[复制链接]
发表于 昨天 12:32 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 dieam 于 2026-3-6 12:35 编辑

各位大佬,我使用NCL绘图,输出的eps文件在AI中打开时会出现“无法完成操作,因为出现未知错误”的问题,不知道是不是因为绘图设置的问题。


直接通过x11查看以及输出pdf是没有问题的,绘制的内容如图。参考施宁老师书中的代码,绘制中国地图部分以及附加南海小地图。


微信图片_2026-03-06_120811_313.png



错误如下

ScreenShot_2026-03-06_122410_039.png



pdf文件虽然可以在AI中打开,但不适宜编辑。例如我想直接更改长江黄河粗细,或者更改地图边界粗细时,无法整体选中,相应的部分被分割了成若干小线段。

并且,pdf文件添加到word或者ppt中时,文件会非常大,这是一个很主要的原因。之前通过AI打开eps文件,复制到word中,图片质量高,文件占用空间是很小的。


不知道各位大佬有没有遇到过相关问题,有无解决的方案。



绘图部分代码如下:


  1. plottype = "eps"
  2. plotname = outpath + outname
  3. plotname@wkColorModel = "rgb"
  4. ;  plottype@wkHeight     = 2000
  5. ;  plottype@wkWidth      = 2000

  6. wks = gsn_open_wks(plottype, plotname)
  7. gsn_define_colormap(wks, "NCV_blu_red")

  8. ;;

  9. res_map               = True
  10. res_map@gsnDraw       = False
  11. res_map@gsnFrame      = False
  12. res_map@gsnAddCyclic  = False

  13. res_map@vpHeightF = 0.4
  14. res_map@vpWidthF  = 0.6


  15. res_map@mpDataBaseVersion           = "MediumRes"  ; Ncarg4_1
  16. res_map@mpDataSetName               = "$NCARG_ROOT/database/Earth..4"

  17. res_map@mpAreaMaskingOn             = True
  18. ;  res_map@mpDataBaseVersion           = "Ncarg4_1"
  19. ;  res_map@mpDataSetName               = "Earth..4"

  20. res_map@mpLandFillColor             = 0
  21. res_map@mpInlandWaterFillColor      = 0
  22. res_map@mpOceanFillColor            = 0

  23. res_map@mpFillOn                    = True
  24. ;  res_map@mpFillDrawOrder             = "PostDraw"
  25. res_map@mpMaskAreaSpecifiers        = (/"China","Taiwan","Arunachal Pradesh",\
  26.                                          "Disputed area between India and China"/)
  27. res_map@mpOutlineOn                 = False
  28. res_map@mpOutlineBoundarySets       = "Geophysical"
  29. res_map@mpGeophysicalLineColor      = "black"
  30. ;  res_map@mpMaskAreaSpecifiers        = (/"China","Taiwan"/)
  31. ;  res_map@mpFillAreaSpecifiers        = (/"China","water","land"/)
  32. ;  res_map@mpSpecifiedFillColors       = (/"transparent","white","white"/)
  33. res_map@mpOutlineOn                 = False
  34. res_map@mpOutlineSpecifiers         = (/"China","Taiwan"/)
  35. res_map@mpGeophysicalLineThicknessF = 1.
  36. res_map@mpNationalLineColor         = "black"
  37. res_map@mpNationalLineThicknessF    = 1.

  38. res_nanhai = res_map

  39. res_map@mpMinLatF                  = 15
  40. res_map@mpMaxLatF                  = maxlat
  41. res_map@mpMinLonF                  = minlon
  42. res_map@mpMaxLonF                  = maxlon
  43. ;  res_map@mpCenterLonF               = 125
  44. ;  res_map@gsnMajorLatSpacing         = 10
  45. ;  res_map@gsnMajorLonSpacing         = 5
  46. ;  res_map@pmTickMarkDisplayMode      = "Always"


  47. res_map@tmXBValues      = ispan(80,140,20)
  48. res_map@tmXBLabels      = (/"80~S~o~N~E","100~S~o~N~E","120~S~o~N~E","140~S~o~N~E"/)
  49. res_map@tmXBMinorValues = ispan(70,140,10)

  50. res_map@tmYLValues      = ispan(20,50,10)
  51. res_map@tmYLLabels      = (/"20~S~o~N~N","30~S~o~N~N","40~S~o~N~N","50~S~o~N~N","55~S~o~N~N"/)
  52. res_map@tmYLMinorValues = ispan(15,55,10)
  53. ;  res_map@tmYLMinorValues = ispan(20,50,10)


  54. res_map@tmXTOn                 = False
  55. res_map@tmYROn                 = False
  56. res_map@tmXBLabelFontHeightF   = 0.02
  57. res_map@tmYLLabelFontHeightF   = 0.02
  58. res_map@tiYAxisString          = " "
  59. res_map@tmXBLabelDeltaF        = -0.6
  60. res_map@tmYLLabelDeltaF        = -0.6

  61. res_map@tmBorderThicknessF     = 2.5

  62. res_map@tmXBMajorThicknessF = 2.5
  63. res_map@tmYLMajorThicknessF = 2.5
  64. res_map@tmXBMinorThicknessF = 2.
  65. res_map@tmYLMinorThicknessF = 2.

  66. res_map@tmXBMajorLengthF         = 0.009
  67. res_map@tmXBMajorOutwardLengthF  = 0.009
  68. res_map@tmYLMajorLengthF         = 0.009
  69. res_map@tmYLMajorOutwardLengthF  = 0.009

  70. res_map@tmXBMinorOn              = True
  71. res_map@tmYLMinorOn              = True
  72. res_map@tmXBMinorLengthF         = 0.006
  73. res_map@tmXBMinorOutwardLengthF  = 0.006
  74. res_map@tmYLMinorLengthF         = 0.006
  75. res_map@tmYLMinorOutwardLengthF  = 0.006


  76. res_map@cnFillOn                    = True
  77. res_map@cnLinesOn                   = False
  78. res_map@cnLineColor                 = "black"
  79. res_map@cnLineThicknessF            = 1.
  80. res_map@cnLineLabelsOn              = False
  81. res_map@cnInfoLabelOn               = False
  82. res_map@lbLabelBarOn                     = False
  83. res_map@pmLabelBarHeightF           = 0.05
  84. res_map@pmLabelBarWidthF            = .5
  85. res_map@lbLabelFontHeightF          = 0.018
  86. res_map@pmLabelBarOrthogonalPosF    = 0.205

  87. res_map@gsnLeftStringFontHeightF       = 0.018
  88. res_map@gsnRightStringFontHeightF      = 0.018
  89. res_map@gsnLeftStringOrthogonalPosF    = 0.032
  90. ;res_map@gsnLeftStringParallelPosF      = -.05
  91. res_map@gsnRightStringOrthogonalPosF   = 0.032
  92. ;  res_map@gsnRightStringParallelPosF     = 1.16


  93. res_map@gsnLeftString         = var_plot&time(i)
  94. res_map@gsnRightString        = ""

  95. res_map@cnFillOn              = True
  96. res_map@cnRasterSmoothingOn   = False
  97. res_map@cnLinesOn             = False
  98. res_map@cnLineLabelsOn        = False
  99. res_map@cnInfoLabelOn         = False

  100. res_map@cnMonoFillPattern     = False
  101. res_map@cnMonoFillScale       = False ;控制点的间隔
  102. ;  res_map@cnFillColors          = (/"#818181","#00b0ff"/)  
  103. res_map@cnFillColors          = (/"#818181", "#FF69B4", "#58b400"/)
  104. res_map@cnFillPatterns        = (/-1, 5, 5/)
  105. res_map@cnFillDotSizeF        = 0.0045             ;点大小
  106. res_map@cnFillScales          = (/1.0, 1.0, 1.0/) ; 点间距
  107. res_map@cnLevelSelectionMode  = "ExplicitLevels"
  108. res_map@cnLevels              = (/0.5/)


  109. plot = gsn_csm_contour_map(wks, var2plot, res_map)
  110. ;  plot = gsn_csm_contour_map(wks, var(i,:,:), res_map)


  111. ; ------------------------------------------------------------------------------------------------------------
  112. ;;;  draw CN map

  113. shp_path              = "/home/zhou/cnmap/cnmap.shp"
  114. pres                  = True
  115. pres@gsLineColor      = "black"
  116. pres@gsLineThicknessF = 1.5

  117. outline_china = gsn_add_shapefile_polylines(wks, plot, shp_path, pres)

  118. ;;;
  119. ; ------------------------------------------------------------------------------------------------------------


  120. ; ------------------------------------------------------------------------------------------------------------
  121. ;;; draw nanhai

  122. xlon = (/130,140,140,130,130/)
  123. ylat = (/15,15,27.5,27.5,15/)

  124. reg  = True
  125. reg@gsFillColor = "white"

  126. gsn_polygon(wks, plot, xlon, ylat, reg)


  127. ;  res_nanhai@vpWidthF  = .1
  128. ;  res_nanhai@vpHeightF = .125

  129. res_nanhai@vpXF      = 0.695
  130. res_nanhai@vpYF      = 0.46
  131. res_nanhai@vpWidthF  = .1
  132. res_nanhai@vpHeightF = .125

  133. res_nanhai@mpMinLatF = 0
  134. res_nanhai@mpMaxLatF = 25
  135. res_nanhai@mpMinLonF = 105
  136. res_nanhai@mpMaxLonF = 125

  137. res_nanhai@mpOutline    = False
  138. res_nanhai@tmXBLabelsOn = False
  139. res_nanhai@tmXTLabelsOn = False
  140. res_nanhai@tmYLLabelsOn = False
  141. res_nanhai@tmYRLabelsOn = False

  142. res_nanhai@tmXBOn = False
  143. res_nanhai@tmXTOn = False
  144. res_nanhai@tmYLOn = False
  145. res_nanhai@tmYROn = False


  146. res_nanhai@gsnLeftString  := ""
  147. res_nanhai@gsnRightString := ""

  148. res_nanhai@cnFillOn             = True
  149. res_nanhai@cnRasterSmoothingOn  = False
  150. res_nanhai@cnLinesOn            = False
  151. res_nanhai@cnLineLabelsOn       = False
  152. res_nanhai@cnInfoLabelOn        = False
  153. res_nanhai@lbLabelBarOn         = False

  154. res_nanhai@cnMonoFillPattern    = False
  155. res_nanhai@cnMonoFillScale      = False ;控制点的间隔
  156. res_nanhai@cnFillColors         = res_map@cnFillColors  
  157. res_nanhai@cnFillPatterns       = res_map@cnFillPatterns
  158. res_nanhai@cnFillDotSizeF       = res_map@cnFillDotSizeF
  159. res_nanhai@cnFillScales         = res_map@cnFillScales

  160. ;  res_nanhai@cnLevelSelectionMode  = "ExplicitLevels"
  161. ;  res_nanhai@cnLevels              = (/0.5/)

  162. res_nanhai@cnLevelSelectionMode = "ExplicitLevels"
  163. res_nanhai@cnLevels             = res_map@cnLevels


  164. map_nanhai = gsn_csm_contour_map(wks, var2plot, res_nanhai)


  165. res_nanhai@gsLineColor      = "black"
  166. res_nanhai@gsLineThicknessF = 1.5

  167. plotnh = gsn_add_shapefile_polylines(plot, map_nanhai, shp_path, res_nanhai)

  168. ; ------------------------------------------------------------------------------------------------------------



  169. ; ------------------------------------------------------------------------------------------------------------
  170. ;;; plot rivers
  171. river_path = "/home/zhou/cnmap_NetCDF/river.nc"
  172. river                   = True
  173. river@gsLineThicknessF  = 1.5   
  174. river@gsLineColor       = "blue"

  175. plotrv = gsn_add_shapefile_polylines(wks, plot, river_path, river)

  176. ; ------------------------------------------------------------------------------------------------------------


  177. draw(plot)
  178. draw(map_nanhai)
  179. frame(wks)
复制代码

复制代码

密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表