Label shift in using pshistogram

Hi,

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?

Elmas

image

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?

Thanks,

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 > test.ps

and the data is

-1.6235
-2.1484
-5.7339
3.2487
0.7028
5.8063
2.7819
1.2027
-0.6019
5.5985
-1.9456
-3.6984
-0.7532
-3.1650
-1.2689
8.1582
1.9017
-2.3500
-1.2843
-1.0090
-1.4427
-0.0097
-1.5532
0.6464
-0.4861
0.9985
-1.3189
-2.0832
7.8369
3.4968
-1.7037
-2.3491
-3.5794
-1.7366
-0.5344

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 > test.ps

and upload your test.ps 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.

test.zip (6.7 KB)

Attached is the ps file I just generated using GMT 6.1.1 on macOS.

test2.zip (6.7 KB)

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

743,747c743,747
< 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
749c749
< /PSL_A0_y PSL_A0_y 33 add def
---
> /PSL_A0_y PSL_A0_y 83 add def
751c751
< (         0) mr Z
---
> (0) mr Z
753c753
< (        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
test_debug.zip (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 > test.ps

zip defaults.txt and test.ps and upload the zipped file?

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

Elmas,
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 > test.ps

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

2 Likes