Hi Mike,

About this question: TypeError: coercing to Unicode: need string or buffer, dict found

The version of matplotlib that i'm using is matplotlib-0.99.1-py2.6

And how do I remove the font cache in ~ / .matplotlib / fontList.cache

My Operating System is Windows.

Thanks,

On Wed, May 23, 2012 at 11:15 AM, <matplotlib-users-request@lists.sourceforge.net> wrote:
Send Matplotlib-users mailing list submissions to
       matplotlib-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
       https://lists.sourceforge.net/lists/listinfo/matplotlib-users
or, via email, send a message with subject or body 'help' to
       matplotlib-users-request@lists.sourceforge.net

You can reach the person managing the list at
       matplotlib-users-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Matplotlib-users digest..."


Today's Topics:

  1. Re: Difference in show and output file (rajtendulkar)
  2. TypeError: coercing to Unicode: need string or    buffer, dict
     found (Wal?ria Antunes David)
  3. Re: TypeError: coercing to Unicode: need string or buffer,
     dict found (Michael Droettboom)
  4. Re: barchart errorbars always in both directions (Benjamin Root)
  5. Re: Slow imshow when zooming or panning with several synced
     subplots (Sergi Pons Freixes)
  6. Re: barchart errorbars always in both directions
     (Meesters, Aesku.Kipp Institute)


----------------------------------------------------------------------

Message: 1
Date: Wed, 23 May 2012 02:49:05 -0700 (PDT)
From: rajtendulkar <pranav.tendulkar@gmail.com>
Subject: Re: [Matplotlib-users] Difference in show and output file
To: matplotlib-users@lists.sourceforge.net
Message-ID: <33894599.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Just in case, if anyone needs the answer, I figured it out.
I used the transData transform in order to draw the lines correctly.

Here is the code -

# The code below is to add the lines near the tick labels
fig = barGraph.fig
xAxisLim=barGraph.ax.xaxis.get_view_interval()
tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
yStart=-70
yEnd=-0.5
line = Line2D([xAxisLim[0], xAxisLim[0]],
             [yStart,yEnd],linewidth=2, color='black',
              transform=barGraph.ax.transData)

fig.lines.append(line)

for i in xrange(11):
   lnWidth=2
   yStartOffset=0
   if((i+1)%4 != 0):
       lnWidth=1
       yStartOffset=20
   xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
   line = Line2D([xOffset, xOffset],
             [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
              transform=barGraph.ax.transData)
   fig.lines.append(line)


line = Line2D([xAxisLim[1], xAxisLim[1]],
             [yStart,yEnd],linewidth=2, color='black',
              transform=barGraph.ax.transData)

fig.lines.append(line)

plt.figtext(0.247, 0.05, '1')
plt.figtext(0.523, 0.05, '2')
plt.figtext(0.797, 0.05, '4')


Thank You!
Raj


rajtendulkar wrote:
>
> Dear All,
>
> I am trying to write a program in matplotlib to generate stacked bar
> graphs.
> My problem is that the commands -  plt.show() and
> self.fig.savefig(fileName) generate different outputs.
> I tried different output formats like PDF, PNG, EPS. But the problem
> remains the same.
> This happens for the lines that I am trying to draw outside the plot.
> I am trying to draw vertical lines between xticklabels.
> I have uploaded the data file and the code file.
>  http://old.nabble.com/file/p33893817/data.dat data.dat
>  http://old.nabble.com/file/p33893817/matplot1.py matplot1.py
> Could anyone explain how to resolve this problem?
>
> Thank You,
> Raj
>

--
View this message in context: http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
Sent from the matplotlib - users mailing list archive at Nabble.com.




------------------------------

Message: 2
Date: Wed, 23 May 2012 09:16:09 -0300
From: Wal?ria Antunes David <waleriantunes@gmail.com>
Subject: [Matplotlib-users] TypeError: coercing to Unicode: need
       string or       buffer, dict found
To: Matplotlib Users <matplotlib-users@lists.sourceforge.net>
Message-ID:
       <CAEwvc_uK2icxVBzF5Aykka-_Mig4EoCNovgt2jPJHT=XQdVc2Q@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

Anyone know how to solve this error?

Exception Type: TypeError Exception Value: coercing to Unicode: need string
or buffer, dict found

Can you help me??

See mycode: http://dpaste.com/751460/

And see my Traceback: http://dpaste.com/750773/


Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 3
Date: Wed, 23 May 2012 08:29:48 -0400
From: Michael Droettboom <mdroe@stsci.edu>
Subject: Re: [Matplotlib-users] TypeError: coercing to Unicode: need
       string or buffer, dict found
To: <matplotlib-users@lists.sourceforge.net>
Message-ID: <4FBCD83C.6030109@stsci.edu>
Content-Type: text/plain; charset="iso-8859-1"

It's a long shot, but have you tried removing the font cache in
~/.matplotlib/fontList.cache?  What version of matplotlib are you using?

Mike

On 05/23/2012 08:16 AM, Wal?ria Antunes David wrote:
> Hi,
>
> Anyone know how to solve this error?
>
> Exception Type: TypeError Exception Value: coercing to Unicode: need
> string or buffer, dict found
>
> Can you help me??
>
> See mycode: http://dpaste.com/751460/
>
> And see my Traceback: http://dpaste.com/750773/
>
>
> Thanks,
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 4
Date: Wed, 23 May 2012 08:55:42 -0400
From: Benjamin Root <ben.root@ou.edu>
Subject: Re: [Matplotlib-users] barchart errorbars always in both
       directions
To: "Meesters, Aesku.Kipp Institute" <meesters@aesku-kipp.com>
Cc: "matplotlib-users@lists.sourceforge.net"
       <matplotlib-users@lists.sourceforge.net>
Message-ID:
       <CANNq6F=aDPutpkRL815URKgQ6uOrkR8gxYZt7-G1s6UhQU_WBA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute <
meesters@aesku-kipp.com> wrote:

> Hi,
>
> I'm following the example in the gallery to do a barchart plot (see
> http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
>
> In contrast to the example I would like to see the error bars only above
> the bars, so I tried
>
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
>                yerr=stds, error_kw = {'barsabove': True,
>                                       'ecolor'   : 'k'}
>
> While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
> effect (error bars still point up and downwards) - yet, no warning /
> error is triggered. Where is my mistake? Or is this a bug (still using
> version 1.0.1) with a known work-around?
>
> TIA
> Chris
>
>
Chris,

I don't think "barsabove" does what you want.  By "above", it means that
the errorbar is plotted in a layer on top of the plotting symbol rather
than in the layer under it.  Both ends will be plotted.

To get what you want, you might want to try (Note: untested):

rects2 = ax.bar(ind+width, womenMeans, width, color='y',
              yerr=np.vstack([[0]*len(stds), stds]), error_kw = {'ecolor'
 : 'k'})

When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :] and
y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row is all
zeros and the second row is the stds values.

I hope that works for you!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 5
Date: Wed, 23 May 2012 15:04:21 +0200
From: Sergi Pons Freixes <sponsfreixes@gmail.com>
Subject: Re: [Matplotlib-users] Slow imshow when zooming or panning
       with several synced subplots
To: matplotlib-users@lists.sourceforge.net
Message-ID:
       <CAMxkOiPwj1bmSnSp4RBqSu+8E6f0DA9mK3scLLqegnGk8oxOgA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
<guillaume@mitotic-machine.org> wrote:
> Hello
>
>
> What is the size of a single image file? If they are very big, it is
> better to do everything from processing to ploting at once for each file.

As stated below, each image is single-channel, of 4600x3840 pixels. As
you can see on the code, there is not much processing, just loading
the images and plotting them. What it's slow is not the execution of
the code, is the interactive zooming and panning once the plots "are
in the screen".

>> It's 15 images, single-channel, of 4600x3840 pixels each.
> This is a lot of data. ?8bit or 16bit ?

They are floating point values (for example, from 0 to 45.xxx). If I
understood correctly, setting the vmin and vmax, matplotlib should
normalize the values to an appropriate number of bits.

>> for f in filelist:
> everything should happen in this loop
>
>> ? ? ?dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
>> ? ? ?data.append(dataset.variables[variable][:])
> instead of creating this big list, use a temporary array (which will be
> overwritten)
>> ? ? ?dataset.close()
>> ? ? ?dates.append((f.split('_')[2][:-3],f.split('_')[1]))

Why? It's true that this way at the beginning it eats a lot of RAM,
but then it is released after each pop() (and calculating the maximum
of all the data without plotting is needed to use the same
normalization level on all the plots). Anyway, the slowness ocurrs
during the interaction of the plot, not during the execution of the
code.



------------------------------

Message: 6
Date: Wed, 23 May 2012 14:14:05 +0000
From: "Meesters, Aesku.Kipp Institute" <meesters@aesku-kipp.com>
Subject: Re: [Matplotlib-users] barchart errorbars always in both
       directions
To: "ben.root@ou.edu" <ben.root@ou.edu>
Cc: "matplotlib-users@lists.sourceforge.net"
       <matplotlib-users@lists.sourceforge.net>
Message-ID: <1337782494.2773.10.camel@meesters>
Content-Type: text/plain; charset="utf-8"

Thanks, Ben. This is indeed what I was looking for and gives the desired
behavior.

Thanks a lot!
Chris

On Wed, 2012-05-23 at 08:55 -0400, Benjamin Root wrote:
>
> On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute
> <meesters@aesku-kipp.com> wrote:
>         Hi,
>
>         I'm following the example in the gallery to do a barchart plot
>         (see
>         http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
>
>         In contrast to the example I would like to see the error bars
>         only above
>         the bars, so I tried
>
>         rects2 = ax.bar(ind+width, womenMeans, width, color='y',
>                        yerr=stds, error_kw = {'barsabove': True,
>                                               'ecolor'   : 'k'}
>
>         While the 'ecolor' argument gets accepted, 'barsabove'
>         apparently has no
>         effect (error bars still point up and downwards) - yet, no
>         warning /
>         error is triggered. Where is my mistake? Or is this a bug
>         (still using
>         version 1.0.1) with a known work-around?
>
>         TIA
>         Chris
>
>
> Chris,
>
> I don't think "barsabove" does what you want.  By "above", it means
> that the errorbar is plotted in a layer on top of the plotting symbol
> rather than in the layer under it.  Both ends will be plotted.
>
> To get what you want, you might want to try (Note: untested):
>
> rects2 = ax.bar(ind+width, womenMeans, width, color='y',
>                yerr=np.vstack([[0]*len(stds), stds]), error_kw =
> {'ecolor'   : 'k'})
>
> When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :]
> and y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row
> is all zeros and the second row is the stds values.
>
> I hope that works for you!
> Ben Root
>
>


------------------------------

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


End of Matplotlib-users Digest, Vol 72, Issue 25
************************************************