Re: plot bar graph in Postscript [message #80956] |
Mon, 30 July 2012 05:07  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
joa writes:
> I am trying to plot a histogram. I have both the data and normal coordinates of each rectangle that makes a bar graph, say, (x0[i],y0[i]),(x1[i],y0[i]),(x1[i],y1[i]),and (x0[i],y1[i]). Then
> for i=0, nt-1 do polyfill,[x0[i],x0[i],x1[i],x1[i]],[y0[i],y1[i],y1[i],y0[i]] , should make the graph. Yes, it looks fine on an IDL X window. But it does not translate to a Postscript file, in which the some bars appear slightly shifted in X-direction. I even tried
> for i=0,nt-1 do tv,bytarr(1,1)+120b,x0[i],y0[i],xs=x1[i]-x0[i],ys=y1[i]-y0[i ],/norm (120b is just to make the bars gray), but the result was the same.
>
> Is this a known feature of IDL? Could you advise how to make uniform bars in Postscript?
This is basically how I draw bars in cgHistoplot. I've
never seen any kind of a problem in PostScript:
http://www.idlcoyote.com/graphics_tips/histoplot.php
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: plot bar graph in Postscript [message #81036 is a reply to message #80956] |
Wed, 01 August 2012 08:22  |
joa
Messages: 2 Registered: July 2012
|
Junior Member |
|
|
On Monday, July 30, 2012 5:07:28 AM UTC-7, David Fanning wrote:
> joa writes:
>
>
>
>> I am trying to plot a histogram. I have both the data and normal coordinates of each rectangle that makes a bar graph, say, (x0[i],y0[i]),(x1[i],y0[i]),(x1[i],y1[i]),and (x0[i],y1[i]). Then
>
>> for i=0, nt-1 do polyfill,[x0[i],x0[i],x1[i],x1[i]],[y0[i],y1[i],y1[i],y0[i]] , should make the graph. Yes, it looks fine on an IDL X window. But it does not translate to a Postscript file, in which the some bars appear slightly shifted in X-direction. I even tried
>
>> for i=0,nt-1 do tv,bytarr(1,1)+120b,x0[i],y0[i],xs=x1[i]-x0[i],ys=y1[i]-y0[i ],/norm (120b is just to make the bars gray), but the result was the same.
>
>>
>
>> Is this a known feature of IDL? Could you advise how to make uniform bars in Postscript?
>
>
>
> This is basically how I draw bars in cgHistoplot. I've
>
> never seen any kind of a problem in PostScript:
>
>
>
> http://www.idlcoyote.com/graphics_tips/histoplot.php
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
It turns out that the irregular spacing I noted came from ps2pdf and other graphics converter programs. I looked at the results in pdf and gif after the conversion. Even though the graph still does not look nice on ghostview, it is fine on print directly from the postscript file. Thank you for reminding me that I was doing the right thing.
|
|
|