ax2.set_ylabel(r'Rainfall frequency(%)($\blacksquare$)', color=c2,fontsize=fontsize)
I use matplotlib to draw a multi-line chart with dual y-axes.I want to use different symbols on the y-axis label text to correspond to different line chart markers, so that the polyline and the y-coordinate axis can correspond better.
However, the size and position of the symbol of the y-axis label cannot be modified. For example, I want to adjust my triangle to the top and bottom center of the text, and adjust the size of the square to be smaller.
How can I achieve this in latex syntax?
I tried to add the command \scriptsize in front of \blacksquare, but an error message prompted me that the \ in front of scriptsize was not recognized.
ax2.set_ylabel(r'Rainfall frequency(%)($\scriptsize\blacksquare$)', color=c2,fontsize=fontsize)
ValueError:
\scriptsize\blacksquare
^
Unknown symbol: \scriptsize, found '\' (at char 0), (line:1, col:1)
I've also tried using the following code and installing 'pylatex' package but that doesn't seem to work either
from pylatex import Document, Section, Subsection, Command
from pylatex.utils import italic, NoEscape
matplotlib.pyplot.rc('text', usetex=True)
