Skip to content

mathtext.py bra-ket notation axes #3374

Closed

Description

@pederico

When using qutip, which has mathtext.py in the backend, after setting on an axis the label '$\left|-\right>$' the text is not shown

For the label '$\left|\minus\right>$' only a minus sign is shown. It could be that the \left \right symbols are too small to be seen.

The label '$\left|+\right>$' is shown without any problem, and any other symbol instead of -, also.

Activity

  1. tacaswell commented on Aug 17, 2014

    @tacaswell
    Member

    Can you include a minimal amount of code to show this? (If I am understanding this right, I think that two call to ax.text would be enough).

  2. added this to the v1.4.x milestone on Aug 17, 2014
  3. modified the milestones: , v1.4.x on Feb 7, 2015
  4. jfeist commented on Feb 25, 2015

    @jfeist

    After #4147 was fixed, I checked if this one is also fixed, and it seems it is not. On current master, the following example produces a png, pdf and svg where the \left| and \right\rangle characters are missing around the minus signs. Furthermore, I realized that the problem is the same in the interactive backends (at least MacOSX and Qt4Agg, which are the ones I have available here).
    For the plus sign, it works like expected. This is on current master.

    import matplotlib
    matplotlib.use('MacOSX')
    import matplotlib.pyplot as plt
    plt.text(0.4,0.6,r'$\left|-\right\rangle$')
    plt.text(0.4,0.4,r'$\left|\minus\right\rangle$')
    
    plt.text(0.6,0.6,r'$\left|+\right\rangle$')
    plt.text(0.6,0.4,r'$\left|\plus\right\rangle$')
    
    plt.savefig('tmp.png')
    plt.savefig('tmp.pdf')
    plt.savefig('tmp.svg')
    plt.show()
  5. jfeist commented on Mar 3, 2015

    @jfeist

    just pinging @mdboom, @tacaswell because I'm not sure this was seen.

  6. tacaswell commented on Mar 3, 2015

    @tacaswell
    Member

    I assume that is a similar problem with the height of the | and > being scaled to almost zero.

  7. mdboom commented on Mar 3, 2015

    @mdboom
    Member

    This is a tricky one. At the end of the day, I think the metrics on the minus sign are just wrong (it defines a character with negative height). I guess the best we can do is special case it, but that's icky... Oh well, I think I can have a fix ready shortly.

  8. modified the milestones: , on Jul 22, 2015
  9. modified the milestones: , on Oct 3, 2017
  10. anntzer commented on Jan 5, 2018

    @anntzer
    Contributor

    May be worth checking whether another version of computer modern (http://www.ams.org/publications/type1-fonts, http://cm-unicode.sourceforge.net/) has better metrics.

  11. modified the milestones: , on Jan 7, 2018
  12. modified the milestones: v3.0, v3.1 on Aug 11, 2018
  13. modified the milestones: v3.1.0, v3.2.0 on Mar 18, 2019
  14. modified the milestones: v3.2.0, v3.3.0 on Sep 7, 2019
  15. anntzer commented on Feb 9, 2020

    @anntzer
    Contributor

    This was actually fixed by #5871.

  16. modified the milestones: v3.3.0, v2.0.0 on Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions