爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6276|回复: 5

画柱状图,运行没错但不出图

[复制链接]

新浪微博达人勋

发表于 2020-4-23 17:47:06 | 显示全部楼层 |阅读模式

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

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

x
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

begin
x = (/1,2,3,4/)
y = (/78.31, 207.49, 83.76, 384.88/)

wks = gsn_open_wks("png","pre")                  ; send graphics to PNG file
  res                       = True                 ; plot mods desired           
  res@gsnFrame              = False                ; don't advance frame yet
  res@gsnXYBarChart         = True                 ; turn on bar chart
  res@gsnXYBarChartBarWidth = 0.75                 ; change bar widths
  res@gsnXYBarChartColors = (/"red","orange","green", "blue"/)            ; choose colors

  res@trYMinF               = 0                    ; bring bars down to zero
  res@trYMaxF               = 400
  res@trXMinF               = 0                    ; adds space on either end
  res@trXMaxF               = 5                    ; of the 1st and last bars

  res@tiMainString          = ""

  plot = gsn_csm_xy (wks,x,y,res)                  ; create plot
  end

不出图,请问是为什么?

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-4-23 21:26:12 | 显示全部楼层
res@gsnFrame              = False
frame(wks)
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

新浪微博达人勋

发表于 2020-4-23 19:56:53 | 显示全部楼层
png格式啊,你又没写绝对路径,可能要全盘搜索下了。或者你自己知道运行在哪个目录下
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-4-24 10:03:31 | 显示全部楼层
我给你运行了一下,出图了,就是一开始这一句 res@gsnFrame              = False                ; don't advance frame yet不要把
12.png
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-4-24 10:05:40 | 显示全部楼层
begin
x = (/1,2,3,4/)
y = (/78.31, 207.49, 83.76, 384.88/)

wks = gsn_open_wks("x11","pre")                  ; send graphics to PNG file
  res                       = True                 ; plot mods desired           
  ;res@gsnFrame              = False                ; don't advance frame yet
  res@gsnXYBarChart         = True                 ; turn on bar chart
  res@gsnXYBarChartBarWidth = 0.75                 ; change bar widths
  res@gsnXYBarChartColors = (/"red","orange","green", "blue"/)            ; choose colors

  res@trYMinF               = 0                    ; bring bars down to zero
  res@trYMaxF               = 400
  res@trXMinF               = 0                    ; adds space on either end
  res@trXMaxF               = 5                    ; of the 1st and last bars

  res@tiMainString          = ""

  plot = gsn_csm_xy (wks,x,y,res)                  ; create plot
  end
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-4-24 17:19:55 | 显示全部楼层
honey_ 发表于 2020-4-24 10:05
begin
x = (/1,2,3,4/)
y = (/78.31, 207.49, 83.76, 384.88/)

嗯嗯,谢谢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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