I've only been able to plot data with both symbols and lines by
issuing two plot commands, one for markers and one for lines. That's
perfectly fine, but it creates a problem when I try to create a legend
for it. For some reason, the legend command by default alternates
between using symbols and lines, grabbing displaying the symbol from the
first plot command for the first series, then displaying a line type
from the second plot for the next series, etc.
This behavior is a bit strange, and in fact unacceptable when the
same line type is used for each series.
For instance, assume I plot four series using these markers: square,
circle, x and +, and then plotted a solid line to connect each series of
markers. The legend would describe the four series using: square, solid
line, x, solid line. Clearly, that wont' work.
I've been able get around this previously by issuing the legend
command right after the first plot command, before the second plot
command. In my current usage, though, I'm looping through a number of
files that are being plotted on the same graph. In this case, the fact
that I've plotted lines in the preceding loop causes the legend command
to revert to this alternating behavior.
Is there some way to explicitly define the symbols used by the legend
command? Or some way to plot lines with markers in the same command
which would presumably avoid this problem?
In general, plotting with matplotlib is so easy and intuitive that
I'm surprised to be having so much difficulty doing something as simple
as this. I'm sure I must be missing something obvious. The
documentation of the legend command was unenlightening.
Thanks,
J.S.