Yes, that can work, thanks, but I am still stuck without a bar chart
for other reasons (see point #3 below), and I am still confused. I
have some questions that if answered can hopefully help me get
clearer:
1) What does the comma do exactly? If I put this: "line," I create a
matplotlib line object, whereas if I put just "line" I create a list.
Does this mean that plot() in mpl returns a tuple that contains one
element, which is a mpl line object? (If so, why doesn't it just
return the line object itself?)
2) Why does line, followed by plot() return a mpl line object but
bars, followed by bar() not return some kind of matplotlib object
(like a line)? Why does it instead give the "ValueError: Too many
values to unpack" error?
3) I am getting just hammered with the following error *a lot* in date
plotting lately:
ValueError: ordinal must be >= 1
And I can't figure out what sorts of mistakes or situations are
triggering it. More of the traceback above that error is at the end
of this message. Does someone know when this error will be thrown
when using dates so I can at least know what to check for in my data?
Thanks,
Che
------ more of Traceback:
for ylabel_i in self.subplot.get_yticklabels():
File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 2646,
in get_yticklabels
self.yaxis.get_ticklabels(minor=minor))
File "C:\Python25\lib\site-packages\matplotlib\axis.py", line 1087,
in get_ticklabels
return self.get_majorticklabels()
File "C:\Python25\lib\site-packages\matplotlib\axis.py", line 1071,
in get_majorticklabels
ticks = self.get_major_ticks()
File "C:\Python25\lib\site-packages\matplotlib\axis.py", line 1169,
in get_major_ticks
numticks = len(self.get_major_locator()())
File "C:\Python25\lib\site-packages\matplotlib\dates.py", line 743,
in __call__
self.refresh()
File "C:\Python25\lib\site-packages\matplotlib\dates.py", line 752, in refresh
dmin, dmax = self.viewlim_to_dt()
File "C:\Python25\lib\site-packages\matplotlib\dates.py", line 524,
in viewlim_to_dt
return num2date(vmin, self.tz), num2date(vmax, self.tz)
File "C:\Python25\lib\site-packages\matplotlib\dates.py", line 289,
in num2date
if not cbook.iterable(x): return _from_ordinalf(x, tz)
File "C:\Python25\lib\site-packages\matplotlib\dates.py", line 203,
in _from_ordinalf
dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1
···
On Wed, Jan 26, 2011 at 9:16 PM, Jae-Joon Lee <lee.j.joon@...287...> wrote:
On Thu, Jan 27, 2011 at 10:07 AM, C M <cmpython@...287...> wrote:
I know the 2nd problem is that a dictionary cannot have a mutable
object like a list as a key. But previously, as I said, I was able to
call line, (with the comma) and it would work. In fact, line, with a
comma gives this type:
If you just want a hashable object, can you just cast it to a tuple?
bars = self.subplot.bar(fake_data, fake_data )
bars_tuple = tuple(bars)
bars_tuple can be used as a dictionary key.