Label shift in using pshistogram


When I am trying to plot using pshistogram it is shifting the labels towards the +x direction this will worsen when the size of the figure is getting smaller. Can anyone help?



Never seen that before so a bit suspicious about how you made that plot. Can you provide a short command/data to let us recreate? What GMT version is this, and OS?


The OS is windows and I have tried both GMT 5.4.5 and 6.1.1. The command I used is

gmt pshistogram test.dat -Bxa2f1+l"test " -Bya10f5+l"Frequency" -BWS -N+p1 -R-8/8/0/30 -Jx0.3/0.15c -Gorange -L0.5p -W1 -F -V -K >

and the data is


Not reproducible. I changed the scale to make it even smaller and annotations still align [of course at some point one needs to change the font size]. How are you converting the PostScript figure to what you posted? I ran

gmt pshistogram test.dat -Bxa2f1+l"test " -Bya10f5+l"Frequency" -BWS -N+p1 -R-8/8/0/30 -Jx0.2/0.15c -Gorange -L0.5p -W1 -F -png t

Do you still get the same as me or a bad plot?

Hi Paul,

I have used what you have used, i.e

gmt pshistogram test.dat -Bxa2f1+l"test " -Bya10f5+l"Frequency"
-BWS -N+p1 -R-8/8/0/30 -Jx0.2/0.15c -Gorange -L0.5p -W1 -F -png t

and I have got

Does it have soemthing to do with my OS (Windows 7)?

Hi Paul,

By the way please note that the axis title is also moved toward left (Frequency) and I can’t move it, with any of the GMT commands.

Can you run this command (your command, but without -V and -K):

gmt pshistogram test.dat -Bxa2f1+l"test" -Bya10f5+l"Frequency" -BWS -N+p1 -R-8/8/0/30 -Jx0.3/0.15c -Gorange -L0.5p -W1 -F >

and upload your file?

Note: Discourse forum doesn’t allow upload .ps files. So you need to zip the file before uploading.

Please find herewith attached the file, which was generated after removing -V and -K options. (6.7 KB)

Attached is the ps file I just generated using GMT 6.1.1 on macOS. (6.7 KB)

These two PS files show slight differences, but I don’t know why they diff. Perhaps @pwessel can know why.

< 167 F0
< (         0) sw mx
< (        10) sw mx
< (        20) sw mx
< (        30) sw mx
> 200 F0
> (0) sw mx
> (10) sw mx
> (20) sw mx
> (30) sw mx
< /PSL_A0_y PSL_A0_y 33 add def
> /PSL_A0_y PSL_A0_y 83 add def
< (         0) mr Z
> (0) mr Z
< (        10) mr Z
> (10) mr Z

... more differences are not shown

As you’re on Windows, perhaps @Joaquim can also give it a try.

I run the example in win7 (and GMT6.1.1) and the figure was ok (similar to the one of pwessel).

Thanks to all,
I even tried to run it from a comand line and it is the same problem. It is really confusing.

I see the same differences (plus 1) as Dongdong.

Ane what is the ghostscript version in these cases? I guess if you are using the WIn installer you get the latest. Maybe @Joaquim can tell in the debugger why it is writing ( 10) instead of (10).

ghostscript version should not matter here since the question is why the PS’s differ.
What could I debug, my ps looks fine?

Sorry, I thought your PS had all that space in front of the numbers. So that only appears in @Elmas PS file. Since @Esteban82 runs on Win7 as well and has no problems, there must be something strange on @Elmas Windows setup. In the past, odd things I can recall involves different LOCALEs, for instance some Germans had a LOCALE that used commas as decimal indicators, making GMT only read integers.
You can try and run again with -Vd and post all that output but this does not look like a GMT issue.

Please find herewith a file generated using -Vb (1.3 KB)

It can not be the Locale (attached herewith) as I am using GMT on the same computer and setup,for more than 3 years.

Could you run these commands:

gmt defaults > defaults.txt
gmt pshistogram test.dat -Bxa2f1+l"test" -Bya10f5+l"Frequency" -BWS -N+p1 -R-8/8/0/30 -Jx0.3/0.15c -Gorange -L0.5p -W1 -F >

zip defaults.txt and and upload the zipped file?

Please find herewith attached the defaults and ps files (8.4 KB)

Try the following command:

gmt pshistogram test.dat -Bxa2f1+ltest -Bya10f5+lFrequency -BWS -N+p1 -R-8/8/0/30 -Jx0.3/0.15c -Gorange -L0.5p -W1 -F --FORMAT_FLOAT_MAP=%.12g >

Appears that your default FORMAT_FLOAT_MAP=%10.0f is causing this issue