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

Home » Public Forums » archive » Problem saving a simple png plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Problem saving a simple png plot [message #94933] Tue, 19 December 2017 01:47 Go to next message
steven.abel is currently offline  steven.abel
Messages: 13
Registered: April 2016
Junior Member
Hi

I am having an issue with saving a png file from a plot with Julian days on the x-axis (IDL 8.2). A very simple example is below


p=PLOT([0,1],[0,1],XRANGE=[5,28],/NODATA,DIMENSIONS=[1400,40 0])
p.SAVE,'test.png'

The above works ok - xrange has small numbers

p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIME NSIONS=[1400,400])
p.SAVE,'test2.png'

The above doesn't work where xrange now has example Julian days (larger numbers). The png file does not display the axes properly. I have tried playing around with the resolution keywords but this does not seem to help.

Any ideas?

Cheers

Steve
Re: Problem saving a simple png plot [message #94934 is a reply to message #94933] Tue, 19 December 2017 02:36 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 12/19/2017 10:47 AM, Steve wrote:
> I am having an issue with saving a png file from a plot with Julian
> days on the x-axis (IDL 8.2). A very simple example is below
>
>
> p=PLOT([0,1],[0,1],XRANGE=[5,28],/NODATA,DIMENSIONS=[1400,40 0])
> p.SAVE,'test.png'
>
> The above works ok - xrange has small numbers
>
> p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIME NSIONS=[1400,400])
>
> p.SAVE,'test2.png'
>
> The above doesn't work where xrange now has example Julian days
> (larger numbers). The png file does not display the axes properly. I
> have tried playing around with the resolution keywords but this does
> not seem to help.
try one of these:

p3=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA, $
DIMENSIONS=[1400,400],xtickformat='(C(CMoA,x,CDI))', $
xtickvalues=[2457982.5:2458002.5:5])
p4=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA, $
DIMENSIONS=[1400,400],xtickformat='(i7)')

otherwise manually set the ticks using xtickvalues,xticknames,xminor

I don't see any problems with saving to png for IDL 8.6 with your code,
but getting rid of the exponents might help. Anyhow it makes your axis
more readable.

I hope this helps, Markus
Re: Problem saving a simple png plot [message #94935 is a reply to message #94934] Tue, 19 December 2017 02:42 Go to previous messageGo to next message
steven.abel is currently offline  steven.abel
Messages: 13
Registered: April 2016
Junior Member
On Tuesday, 19 December 2017 10:36:30 UTC, Markus Schmassmann wrote:
> On 12/19/2017 10:47 AM, Steve wrote:
>> I am having an issue with saving a png file from a plot with Julian
>> days on the x-axis (IDL 8.2). A very simple example is below
>>
>>
>> p=PLOT([0,1],[0,1],XRANGE=[5,28],/NODATA,DIMENSIONS=[1400,40 0])
>> p.SAVE,'test.png'
>>
>> The above works ok - xrange has small numbers
>>
>> p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIME NSIONS=[1400,400])
>>
>> p.SAVE,'test2.png'
>>
>> The above doesn't work where xrange now has example Julian days
>> (larger numbers). The png file does not display the axes properly. I
>> have tried playing around with the resolution keywords but this does
>> not seem to help.
> try one of these:
>
> p3=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA, $
> DIMENSIONS=[1400,400],xtickformat='(C(CMoA,x,CDI))', $
> xtickvalues=[2457982.5:2458002.5:5])
> p4=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA, $
> DIMENSIONS=[1400,400],xtickformat='(i7)')
>
> otherwise manually set the ticks using xtickvalues,xticknames,xminor
>
> I don't see any problems with saving to png for IDL 8.6 with your code,
> but getting rid of the exponents might help. Anyhow it makes your axis
> more readable.
>
> I hope this helps, Markus

Hi

Yes I do use xtickformat='(C(CMoA,x,CDI))', but wanted to keep the example as simple as possible. Both of the examples you gave also result in the same problem in the png file - the right hand y-axis is incomplete.

Perhaps it is an issue with IDL 8.2?

Steve
Re: Problem saving a simple png plot [message #94936 is a reply to message #94935] Wed, 20 December 2017 15:41 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Tuesday, December 19, 2017 at 4:42:54 AM UTC-6, Steve wrote:
Both of the examples you gave also result in the same problem in the png file - the right hand y-axis is incomplete.
>
> Perhaps it is an issue with IDL 8.2?
>
> Steve

Hmm...what do you mean the right hand y-axis is incomplete? Your examples seem to work under 8.5.1.

Is it just the png that's wrong, or is it also a problem on screen?
Re: Problem saving a simple png plot [message #94949 is a reply to message #94936] Thu, 04 January 2018 03:07 Go to previous message
steven.abel is currently offline  steven.abel
Messages: 13
Registered: April 2016
Junior Member
On Wednesday, 20 December 2017 23:41:18 UTC, Phillip Bitzer wrote:
> On Tuesday, December 19, 2017 at 4:42:54 AM UTC-6, Steve wrote:
> Both of the examples you gave also result in the same problem in the png file - the right hand y-axis is incomplete.
>>
>> Perhaps it is an issue with IDL 8.2?
>>
>> Steve
>
> Hmm...what do you mean the right hand y-axis is incomplete? Your examples seem to work under 8.5.1.
>
> Is it just the png that's wrong, or is it also a problem on screen?

Yes it is just the png files - it looks fine on the screen.

Unfortunately I only have access to IDL 8.2
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: text widget example
Next Topic: spam is destroying this group

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

Current Time: Wed Oct 08 11:27:42 PDT 2025

Total time taken to generate the page: 0.00467 seconds