[Python] Best way to create a list of ticklabels by multiples of pi

Discussão em 'Python' iniciado por Stack, Maio 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on Python 3x and I have this list of integers:

    L = [0, 1, 2, 3, 4]


    How could I from L create this list of tick labels:

    T = [0, \pi, 2\pi, 3\pi, 4\pi] ?


    I have no idea and just tried:

    L = [0,1,2,3,4]
    ticklabels = [f'L[{i}]' + r'$\pi$' for i in L]


    which doesn't give the expected result...

    Continue reading...

Compartilhe esta Página