Skip to content

PS_CHAR_ENCODING problem #1994

Closed
Closed

Description

@jhtong33

Description of the problem
Hello,
I want to add octal code to corresponding symbol.
But, there is weird symbol in the text.
Surly, I also change PS_CHAR_ENCODING=Standard+(ISOLatin1+), the problem still exists.
there is existing weird A before the upper circle.

Full code that generated the error

pygmt.config(PS_CHAR_ENCODING='ISOLatin1+')
fig = pygmt.Figure()
avg_phi, avg_dt = angle_mean(dff['dt'], dff['phi'])
fig.rose(length=dff['dt'],
         azimuth=dff['phi'],
         region=[0, 1, -90, 90],
         diameter="6c",
         sector="10",
         labels = 'W,E,-,N',
         norm=True,
         color="red@50",
         frame=['xg0.5',"y30g30", "+gwhite"],
         pen="v2p,red3", 
        vectors = '+wmode_file',
        vector_params='0.7c+e+gred3+h0.5')
fig.text(position="MR", text=f'{int(avg_phi)}\260, {round(avg_dt,2)}s',font='8p')

fig.show()

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.5.0
System information:
  python: 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:36:15)  [Clang 11.1.0 ]
  executable: /Users/tong/opt/anaconda3/envs/split/bin/python
  machine: macOS-10.15.7-x86_64-i386-64bit
Dependency information:
  numpy: 1.21.3
  pandas: 1.3.2
  xarray: 0.20.0
  netCDF4: 1.5.7
  packaging: 21.3
  ghostscript: 9.54.0
  gmt: 6.2.0
GMT library information:
  binary dir: /Users/tong/opt/anaconda3/envs/split/bin
  cores: 4
  grid layout: rows
  library path: /Users/tong/opt/anaconda3/envs/split/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/tong/opt/anaconda3/envs/split/lib/gmt/plugins
  share dir: /Users/tong/opt/anaconda3/envs/split/share/gmt
  version: 6.2.0

There is the output figure:
Screen Shot 2022-07-06 at 5 54 37 PM

Activity

  1. added
    bug
    on Jul 6, 2022
  2. seisman commented on Jul 6, 2022

    @seisman
    Member

    It's because \260 is interpreted as ° by the Python interpreter. So what GMT sees is a Unicode character °, not \260.

    Using \\260 should work for you.

  3. seisman commented on Jul 10, 2022

    @seisman
    Member

    Closing because it's not a bug or a feature request.

  4. added
    question
    and removed
    bug
    on Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions