marker plots

Hi I had some issues with marker plots and automatic color

    > cycling.
    > gives only black crosses. It would be nice if someone could
    > please try this out. My guess is that the "o"s and "v"s do
    > have some kind of black margin and a (colored) filling area
    > which the "+"s and "x"s dont't have. If that's right then
    > anyone should see this behavior. Thanx for your help.

As noted by Christian, the reason for this discrepancy is that '+' is
not filled and 'o' is. filled marker colors are governed by their
'markeredgecolor' and 'markerfacecolor'. line styles are goverened by
'color'. Thus it is not entirely trivial to determine how these three
colors should behave in automatic color cycling. For example, for
filled markers, you might want the face color to automatically cycle
and the edge colors to remain black (or more precisely, their default
rc value). For non-filled markers, which do not have a facecolor, you
might want the edge color to cycle.

Could you specify how you think this should behave? My guess is that
this is sufficiently complicated that different people will want
different default behaviors. As you posted earlier, it is pretty
simple to force the kind of cycling you want in your own code. But if
you can spell out a clear policy of how *it should* work, and there
seems to be a consensus on this, or at least no objection, I can take
a stab at implementing it in the axes code. You can take a look
yourself if you want Axes._process_plot_var_args and
Axes._process_plot_format.

JDH

John Hunter wrote:

"Steve" == Steve Schmerler <elcorto@...361...> writes:

    > Hi I had some issues with marker plots and automatic color
    > cycling.
    > gives only black crosses. It would be nice if someone could
    > please try this out. My guess is that the "o"s and "v"s do
    > have some kind of black margin and a (colored) filling area
    > which the "+"s and "x"s dont't have. If that's right then
    > anyone should see this behavior. Thanx for your help.

As noted by Christian, the reason for this discrepancy is that '+' is
not filled and 'o' is. filled marker colors are governed by their
'markeredgecolor' and 'markerfacecolor'. line styles are goverened by
'color'. Thus it is not entirely trivial to determine how these three
colors should behave in automatic color cycling. For example, for
filled markers, you might want the face color to automatically cycle
and the edge colors to remain black (or more precisely, their default
rc value). For non-filled markers, which do not have a facecolor, you
might want the edge color to cycle.

Could you specify how you think this should behave? My guess is that
this is sufficiently complicated that different people will want
different default behaviors. As you posted earlier, it is pretty
simple to force the kind of cycling you want in your own code. But if
you can spell out a clear policy of how *it should* work, and there
seems to be a consensus on this, or at least no objection, I can take
a stab at implementing it in the axes code. You can take a look
yourself if you want Axes._process_plot_var_args and
Axes._process_plot_format.

JDH

Hi

Well, since mpl changes the markeredgecolor when you request 'r+' and the markerfacecolor when you say 'ro' it would be the most natural way to keep this behavior when "turning on" automatic cycling by

  rcParams["lines.marker"] = <any_marker>
  rcParams["lines.linestyle"] = "None"

Some would even suggest to let the markeredgecolor == markerfacecolor (if there is one) by default for the sake of some "consistency" (i.e. remove the markeredgecolor completely, like in gnuplot). I personally don't care.

Btw, the issue here applies only to pure marker plots (i.e. nothing like 'o-') right? What if you want automatic cycling there?

The ideal behavior would be: Say you want to plot 30 data sets with lines _and_ markers like '+-'. There would be a call like

setAutoMarkerAndColor()
for i in range(...):
  A = load(<dataset>) # or whatever
  plot(A[:,0], A[:,1]) # no formating at all

which would then behave like

def getFormatString(i):
     # works for len(c) = len(m) and all i >= 0
     c = ['b', 'g', 'r']
     # maybe without '.' and ',' because they are pretty small
     m = ['o', 'x', 'v']
     max = len(c)*len(m) - 1
     if (i > max):
         ii = i - max - 1
     else:
         ii = i
     mind = int(floor(ii / len(m)))
     cind = ii - mind * len(m)
     return c[cind] + m[mind]

for i in range(...):
  A = load(<dataset>)
  fs = getFormatString(i)
  plot(A[:,0], A[:,1], fs)

Actually, that's very much it, except that it only works if the numbers of colors and markers are the same.

cheers,
steve

···

--
Women are like cell phones. They like to be held and talked to, but push the wrong button, and you'll be disconnected.