Menu

Change the order in legends

Anonymous
2011-07-18
2012-09-07
  • Anonymous

    Anonymous - 2011-07-18

    Is it possible to change the order of the colors in the legend? When doing a
    stacked bar graph, for example, the legend colors are in reverse order of the
    bars themselves. See: http://phplot.sourceforge.net/phplotdocs/ex-
    stackedbars3.html

    Would there be a way to invert the color order?

     
  • lbayuk

    lbayuk - 2011-07-18

    No, it isn't possible to switch the order in the legend, but it should be! I
    guess I noticed this before, but it never registered as something wrong.

    You are correct - for vertical stacked bar plots, and also for stacked area
    plots, the order of entries in the legend should be reversed so they follow
    the order in the plot. This needs to be fixed.

    I'm thinking of a manual control for this, rather than making it automatic
    depending on the plot type. My reasons are 1) compatibility - I don't like
    plot appearance to change between releases unless there is a very good reason,
    and 2) there could be cases with other plot types where someone wants to
    reverse the order. Any thoughts on this?

     
  • lbayuk

    lbayuk - 2011-07-22

    See bug report http://sourceforge.net/tracker/?func=detail&aid=3370548&group_
    id=14653&atid=114653

    This has been implemented in CVS. SetLegendReverse(True) will reverse the line
    order in the legend. It will be in the next release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.