Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mathtext.py bra-ket notation axes #3374

Closed
pederico opened this issue Aug 17, 2014 · 7 comments
Closed

mathtext.py bra-ket notation axes #3374

pederico opened this issue Aug 17, 2014 · 7 comments
Assignees
Milestone

Comments

@pederico
Copy link

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.

@tacaswell
Copy link
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).

@jfeist
Copy link

jfeist commented Feb 25, 2015

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()

@jfeist
Copy link

jfeist commented Mar 3, 2015

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

@tacaswell
Copy link
Member

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

@mdboom
Copy link
Member

mdboom commented Mar 3, 2015

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.

@tacaswell tacaswell modified the milestones: proposed next point release, next point release Jul 22, 2015
@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@anntzer
Copy link
Contributor

anntzer commented Jan 5, 2018

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.

@tacaswell tacaswell modified the milestones: v2.2, v3.0 Jan 7, 2018
@tacaswell tacaswell modified the milestones: v3.0, v3.1 Aug 11, 2018
@tacaswell tacaswell modified the milestones: v3.1.0, v3.2.0 Mar 18, 2019
@timhoffm timhoffm modified the milestones: v3.2.0, v3.3.0 Sep 7, 2019
@anntzer
Copy link
Contributor

anntzer commented Feb 9, 2020

This was actually fixed by #5871.

@anntzer anntzer closed this as completed Feb 9, 2020
@QuLogic QuLogic removed this from the v3.3.0 milestone Feb 12, 2020
@QuLogic QuLogic added this to the v2.0.0 milestone Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants