comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: -0.0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: -0.0 [message #74556 is a reply to message #74555] Thu, 20 January 2011 11:11 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Jan 20, 1:40 pm, kisCA <ki...@hotmail.com> wrote:
> Hi there,
>
> I am trying to make a plot with xaxis from -0.6 to 0.6. On the xaxis
> it gaves me a -0.0 ? I tried xtickformat='(F4.1)' and '(F0.1)' but no
> success...
>
> pcit= -.6+indgen(13)*.1
>
> !p.font=0     ;use postscript fonts
> set_plot, 'ps'
> ext='.eps'
> cs=0  ;charcter size
> !p.thick=3 ;data
> !x.thick=2 ;x axis
> !y.thick=2 ;y axis
> device, filename='Response Solar Cycle - Annual Mean'+ext,
> encapsulated=eps, $
>     /helvetica,/isolatin1, xsize=8, ysize=12,font_size=8, landscape=0,
> decomposed=0, color=1
> plot,pcit,Zproxy,/nodata,ystyle=1,yrange=[15,50],xtickformat ='(F4.1)'
> oplot,Solarcoef*100,Zproxy,color=0,linestyle=0
> oplot,(Solarcoef+Solarstd)*100,Zproxy,color=204,linestyle=1
> oplot,(Solarcoef-Solarstd)*100,Zproxy,color=204,linestyle=1
> oplot,limiteY,Zproxy,color=0,linestyle=2
> for z=0,n_elements(Zproxy)-1 do begin
>     oplot,[(Solarcoef(z)-Solarvar(z))*100,(Solarcoef(z)
> +Solarvar(z))*100],[Zproxy(z),Zproxy(z)],color=226,linestyle =0
> endfor
> oplot,[-.500,-.400],[48,48],color=0,linestyle=0
> xyouts,-.350,48,'Mean'
> oplot,[-.500,-.400],[47,47],color=204,linestyle=1
> xyouts,-.350,47,'Std'
> oplot,[-.500,-.400],[46,46],color=226,linestyle=0
> xyouts,-.350,46,'Error'
> device,/close
>
> Do you have an idea ?
>
> Cheers


This falls into the "sky is falling" category, although with
a slight different twist.

http://www.dfanning.com/math_tips/sky_is_falling.html

Signed zeros are allowed in the IEEE 754 standard for floating point
arithmetic.

IDL> print,-2.0*0
-0.00000
IDL> print,2.0*0
0.00000

If you don't like that in the plot (and I agree that it looks ugly),
you should
manually change that tick label using the xtickname keyword.

However, that is painful to do, so you could try the following hack:

xrange=[-0.6,0.6]
plot,[0,0],/nodata,/xstyle,xrange=xrange,title='this looks bad'

;workaround
epsilon=1e-6
xrange=[-0.6,0.6]
xrange=xrange+epsilon*[-1,2]
plot,[0,0],/nodata,/xstyle,xrange=xrange,title='better now'


You see what happened there? Care to guess why it worked?

Ciao,
Paolo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Crashes in IDL 7.1 & 8.0, interactive + VM mode, linux and Mac OS X
Next Topic: FSC_contour & NaN

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:07:22 PDT 2025

Total time taken to generate the page: 0.39028 seconds