try to get matplotlib legend items in reversed position -
I am trying to reverse the items which appear in matplotlib legend, that is, I previously labeled a point I want to place the position and the "symbol-symbol" of a point at the second place of the legend, then just reverse the situation mentioned below:
Do you have text and legend Locate the properties of the line Have tried to copy? Something like
leg = legend () txt = legend.get_texts () [0] txt.set_x (-20) line = lg.get_line () [0] line.set_xdata (line. For more legends, more commonly, it becomes LINEOFFSET = 20 TEXTOFFSET = -20 foot = Legend () in leg.get_texts () in txt: leg.get_lines () In line for txt.set_x (TEXTOFFSET): line.set_xdata (line.get_xdata () + LINEOFFSET)
adjust LINEOFFSET
and TEXTOFFSET < / Code> unless you get the desired results
Comments
Post a Comment