Discussion:
plotting vertical lines
(too old to reply)
Leah Huk
2013-04-11 20:04:30 UTC
Permalink
Hello! I'm having a weird issue with the colors and thicknesses of vertical lines plotted using the very simple routine VLINE, written by John Johnson and found here: http://astro.berkeley.edu/~johnjohn/idlprocs/vline.pro.

I'm trying to use this routine to easily overplot markers for wavelengths of certain spectral lines over a spectra and into a .ps output file. It works, however, some of the lines appear grey and of greater thickness, with the exception of the bluest (left most) line. That one looks correct, thinner and black, despite it NOT being plotted first.

First, I tried using TVLCT (follwing your article on "Understanding IDL colors") to specify the RGB values for black and using the THICK keyword to specify thickness. This did not work. The left most line is still black and correct thickness, the others are greyish and thicker. Second thing I tried was to amend the VLINE routine to call cgOPlot instead of regular OPlot, and then called the colors in using the string name. Still doesn't work.

I am stumped. Anyone have any inkling as to why only one of my vertical lines will plot with the correct color/thickness while all the others will not?

ps_open,'filename'
cgDisplay,3000,900,/free
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
vline,6563,color='black',linestyle=0,thick=0.75
vline,4861,color='black',linestyle=0,thick=0.75 (this one looks correct)
vline,5876,color='black',linestyle=1,thick=0.75
vline,5017,color='black',linestyle=1,thick=0.75
ps_close
Phillip Bitzer
2013-04-11 20:19:21 UTC
Permalink
This works for me just fine:

ps_start,'filename.ps'
cgDisplay,3000,900,/free

x = findgen(100)*70 & y = randomu(seed, 100)
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
cgplots, REPLICATE(6563, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(4861, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(5876, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75
cgplots, REPLICATE(5017, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75

ps_end

I'm using:
IDL> print, !version
{ x86_64 darwin unix Mac OS X 8.2.2 Jan 23 2013 64 64}
Leah Huk
2013-04-11 20:29:10 UTC
Permalink
Post by Phillip Bitzer
ps_start,'filename.ps'
cgDisplay,3000,900,/free
x = findgen(100)*70 & y = randomu(seed, 100)
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
cgplots, REPLICATE(6563, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(4861, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(5876, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75
cgplots, REPLICATE(5017, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75
ps_end
IDL> print, !version
{ x86_64 darwin unix Mac OS X 8.2.2 Jan 23 2013 64 64}
Just tried scrapping VLINE and using cgPlotS instead, like your example. Still doesn't work. The line at 4861A looks the way it should, while the other three STILL appear thicker and grey. Arg!
Leah Huk
2013-04-11 20:37:20 UTC
Permalink
I am using
IDL> print,!version
{ x86_64 Win32 Windows Microsoft Windows 8.2.1 Aug 20 2012 64 64}
Post by Leah Huk
Post by Phillip Bitzer
ps_start,'filename.ps'
cgDisplay,3000,900,/free
x = findgen(100)*70 & y = randomu(seed, 100)
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
cgplots, REPLICATE(6563, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(4861, 2), !Y.CRANGE,color='black',linestyle=0,thick=0.75
cgplots, REPLICATE(5876, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75
cgplots, REPLICATE(5017, 2), !Y.CRANGE,color='black',linestyle=1,thick=0.75
ps_end
IDL> print, !version
{ x86_64 darwin unix Mac OS X 8.2.2 Jan 23 2013 64 64}
Just tried scrapping VLINE and using cgPlotS instead, like your example. Still doesn't work. The line at 4861A looks the way it should, while the other three STILL appear thicker and grey. Arg!
Coyote
2013-04-11 22:22:21 UTC
Permalink
Post by Leah Huk
Just tried scrapping VLINE and using cgPlotS instead, like your example. Still doesn't work. The line at 4861A looks the way it should, while the other three STILL appear thicker and grey. Arg!
I have a feeling that everything is probably "working," but whatever you are viewing the output with is not doing a good job. How are you viewing the output?

What happens if you use integers for the thickness values, rather than floats?

Cheers,

David
Leah Huk
2013-04-11 22:53:25 UTC
Permalink
David,
I am using GSview 5.0 to view my .ps. files.

A little while ago I was fiddling with the lines for my vertical line markers, copy-pasting those lines over, deleting the old ones, doing a retall, then saving, recompiling, and re-running. Somehow, some of the lines would magically become the right thickness. Then I'd try implementing the same change process for all 4 of them, and all of a sudden some would revert back to being grey or the wrong thickness again. I just tried setting the thickness to an integer value of 1, and now I have three lines of what appears to be correct thickness and color, yet one of them is still grey and too thick.

Gremlins, I tell you....gremlins.
Post by Leah Huk
Hello! I'm having a weird issue with the colors and thicknesses of vertical lines plotted using the very simple routine VLINE, written by John Johnson and found here: http://astro.berkeley.edu/~johnjohn/idlprocs/vline.pro.
I'm trying to use this routine to easily overplot markers for wavelengths of certain spectral lines over a spectra and into a .ps output file. It works, however, some of the lines appear grey and of greater thickness, with the exception of the bluest (left most) line. That one looks correct, thinner and black, despite it NOT being plotted first.
First, I tried using TVLCT (follwing your article on "Understanding IDL colors") to specify the RGB values for black and using the THICK keyword to specify thickness. This did not work. The left most line is still black and correct thickness, the others are greyish and thicker. Second thing I tried was to amend the VLINE routine to call cgOPlot instead of regular OPlot, and then called the colors in using the string name. Still doesn't work.
I am stumped. Anyone have any inkling as to why only one of my vertical lines will plot with the correct color/thickness while all the others will not?
ps_open,'filename'
cgDisplay,3000,900,/free
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
vline,6563,color='black',linestyle=0,thick=0.75
vline,4861,color='black',linestyle=0,thick=0.75 (this one looks correct)
vline,5876,color='black',linestyle=1,thick=0.75
vline,5017,color='black',linestyle=1,thick=0.75
ps_close
David Fanning
2013-04-11 23:13:32 UTC
Permalink
Post by Leah Huk
I am using GSview 5.0 to view my .ps. files.
A little while ago I was fiddling with the lines for my vertical line markers, copy-pasting those lines over, deleting the old ones, doing a retall, then saving, recompiling, and re-running. Somehow, some of the lines would magically become the right thickness. Then I'd try implementing the same change process for all 4 of them, and all of a sudden some would revert back to being grey or the wrong thickness again. I just tried setting the thickness to an integer value
of 1, and now I have three lines of what appears to be correct thickness and color, yet one of them is still grey and too thick.
Post by Leah Huk
Gremlins, I tell you....gremlins.
I don't think so. This is a display problem, not a PostScript problem.
I'd make sure your units are points in GSView, and I'd turn anti-
aliasing off (the usual culprit in things like this). Or, you could just
print the darn thing and see that it prints fine. Or, you could make a
PDF or PNG file out of it and see that it works fine. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Leah Huk
2013-04-11 23:39:34 UTC
Permalink
Success. Changing anti-aliasing setting in GSview (Text Alpha and Graphics Alpha eq 1) completely fixed the issue. Also, converting to .pdf displayed it properly. Thank you!! I learn something new every time I visit and post on this google group! :)

Leah H.
Post by Leah Huk
Hello! I'm having a weird issue with the colors and thicknesses of vertical lines plotted using the very simple routine VLINE, written by John Johnson and found here: http://astro.berkeley.edu/~johnjohn/idlprocs/vline.pro.
I'm trying to use this routine to easily overplot markers for wavelengths of certain spectral lines over a spectra and into a .ps output file. It works, however, some of the lines appear grey and of greater thickness, with the exception of the bluest (left most) line. That one looks correct, thinner and black, despite it NOT being plotted first.
First, I tried using TVLCT (follwing your article on "Understanding IDL colors") to specify the RGB values for black and using the THICK keyword to specify thickness. This did not work. The left most line is still black and correct thickness, the others are greyish and thicker. Second thing I tried was to amend the VLINE routine to call cgOPlot instead of regular OPlot, and then called the colors in using the string name. Still doesn't work.
I am stumped. Anyone have any inkling as to why only one of my vertical lines will plot with the correct color/thickness while all the others will not?
ps_open,'filename'
cgDisplay,3000,900,/free
cgplot,x,y,title='title',xtitle='xname',ytitle='yname',color='red',thick=3
vline,6563,color='black',linestyle=0,thick=0.75
vline,4861,color='black',linestyle=0,thick=0.75 (this one looks correct)
vline,5876,color='black',linestyle=1,thick=0.75
vline,5017,color='black',linestyle=1,thick=0.75
ps_close
Continue reading on narkive:
Loading...