Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Simple issue with PLOTS?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bill Gallery  
View profile  
 More options Oct 9 2012, 1:53 pm
Newsgroups: comp.lang.idl-pvwave
From: Bill Gallery <wogall...@comcast.net>
Date: Tue, 9 Oct 2012 10:53:59 -0700 (PDT)
Local: Tues, Oct 9 2012 1:53 pm
Subject: Re: Simple issue with PLOTS?

On Tuesday, October 9, 2012 11:08:03 AM UTC-6, Rob wrote:
> Hi,

> It's been quite a while since I've programmed in IDL but I have a

> problem with something very basic. I am drawing a grid using the PLOTS

> command but the final lines are not being drawn (i.e. the top and

> rightmost lines). I might use a hack to get it to look right (i.e.

> enlarge the window by a few pixels) but it's not a very elegant

> solution. Below I list a simple procedure that shows the issue. You

> should see a window pop up with most of the grid except for lines

> along the top and along the right. Any help on my pedestrian

> problem? :o)

> Thanks,

> Rob

> pro test_grid_win

> ; Test program that writes out a PNG file that captures the screen

> with

> ; a grid drawn on it.

> xsize = (ysize = 500)

> device,decomposed = 0 & loadct,0,/silent

> nx = 10

> window,0,xsize = xsize,ysize = ysize

> dx = 1./float(nx)

> erase,255B

> for j = 0,nx do plots,[j*dx,j*dx],[0.0,1.0],/normal,color = 0B

> for j = 0,nx do plots,[0.0,1.0],[j*dx,j*dx],/normal,color = 0B

> ;filename = 'e:\test.png'

> ;WRITE_PNG, filename, TVRD(/TRUE)

> end

Rob,

Try this version of your program.  The comments explain what you need to change and why.

Cheers,
Bill Gallery

pro test_grid_win
; Test program that writes out a PNG file that captures the screen with
; a grid drawn on it.
xsize = (ysize = 500)
device,decomposed = 0 & loadct,0,/silent
nx = 10
window,0,xsize = xsize,ysize = ysize
dx = 1./float(nx)
;;erase,255B
!p.BACKGROUND=255b  ;set the default background color
!p.COLOR=0  ;set the default color of plot axes, points, lines, ...

;;plots places points on an already specified grid
;;You need to first use plot (no s) to set up the scale of the plot and
;;to draw the axes
;;the x and y data set the scale of the plot to x=[0,1], y=[0,1]
;;xgrid=1 and ygrid=1 ensure that the x and y axes are exacty as specified and
;;not expanded
;;/nodata prevents data from actually being plotted
plot, [0,1],[0,1], /nodata, xgrid=1, ygrid=1

;;use oplot to place the data on the existing plot (plots will also work)
;;/normal says that the data is in 'normal' coordinates which vary from
;;[0,0] at the lower left of the screen to [1,1] to the upper right:
;;this is not what you want. You want to draw on the existing data scale
;;which has been created with the plot command.
;;The color of the data has already been specified with !p.color
for j = 0,nx do oplot,[j*dx,j*dx],[0.0,1.0]   ;;,/normal,color = 0B
for j = 0,nx do oplot,[0.0,1.0],[j*dx,j*dx]   ;;,/normal,color = 0B
;filename = 'e:\test.png'
;WRITE_PNG, filename, TVRD(/TRUE)
end


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.