Discussion:
Problem saving a simple png plot
(too old to reply)
Steve
2017-12-19 09:47:15 UTC
Permalink
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,400])
p.SAVE,'test.png'

The above works ok - xrange has small numbers

p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIMENSIONS=[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
Markus Schmassmann
2017-12-19 10:36:27 UTC
Permalink
Post by Steve
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,400])
p.SAVE,'test.png'
The above works ok - xrange has small numbers
p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIMENSIONS=[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
Steve
2017-12-19 10:42:51 UTC
Permalink
Post by Markus Schmassmann
Post by Steve
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,400])
p.SAVE,'test.png'
The above works ok - xrange has small numbers
p=PLOT([0,1],[0,1],XRANGE=[2457981.5,2458004.5],/NODATA,DIMENSIONS=[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.
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
Phillip Bitzer
2017-12-20 23:41:14 UTC
Permalink
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.
Post by Steve
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?
Steve
2018-01-04 11:07:38 UTC
Permalink
Post by Steve
Both of the examples you gave also result in the same problem in the png file - the right hand y-axis is incomplete.
Post by Steve
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

Continue reading on narkive:
Loading...