C M | 9 Feb 21:11
Picon
Gravatar

2 possible bugs with make_axes_area_auto_adjustable

Jae-Joon's code, make_axes_area_auto_adjustable has been a great help to dynamically resizing my plots' axes area--such an improvement.  But there are two bugs I've noticed that I wonder if has been identified/fixed yet:

1) When I point-pick on the plot, the plot area still "jumps" (expands vertically a small amount).  It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only.  But is it possible it can be fixed so it doesn't jump at all?

2) I just noticed that if a plot is resized so that the window that the plot is embedded in is *narrower than the title on the plot*, the resizing of the axes area gets very messed up (it gets *much8 narrower than is necessary to fit the available area).  I'm not sure what the best approach to fixing this is, since it's not ideal to have a title not fit the figure's area, either...is it possible to flow-wrap a plot title?

Thanks,
Che


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Andreas H. | 9 Feb 17:05
Picon

cmap.set_bad() not showing any effect with pcolor()

Hi,

I'm trying to use pcolor on a masked array. I would like masked elements
to show up in a special color. I have written some code, but it does not
seem to work:

I would appreciate any help :)

Cheers,
Andreas.

---8<-------

import matplotlib as mpl
import matplotlib.pyplot as plt

from numpy import linspace
from numpy.random import randn
from numpy.ma import masked_invalid

D = randn(12*72).reshape((12,72))
D[4,:] = nan
D[6,6] = nan

D = masked_invalid(D)

cmap = mpl.cm.bwr
cmap.set_bad('k', 1.)

xbin = linspace(0, 12, 13)
ybin = linspace(-90, 90, 73)

fig = plt.figure()
spl = fig.add_subplot(111)
pl = spl.pcolor(xbin, ybin, D.T, cmap=cmap, edgecolors='none',
                vmin=-5, vmax=5)

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
David Craig | 9 Feb 16:34
Picon

x-axis ticks and labels

Hi,
I am trying to relabel the x-axis on a plot. I want it to have 10 evenly 
spaced labels ranging from 274 at zero to 283 at one increment short of 
the axis. My code is as follows:

     im.axes.xaxis.set_major_locator(py.MaxNLocator(10))
     im.axes.xaxis.set_ticklabels(range(274,284))

My understanding is that MaxNLocator defines the number of spaces 
between labels. I've tried a few variations on the above but can only 
seem to get the last label to be 282 or 284. Anyone know what I am doing 
wrong.
Thanks
D

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
T J | 9 Feb 02:29
Picon
Gravatar

Missing Segments in Output of imshow()

Hi,


I am experiencing missing "segments" in the output of imshow().  I draw a slowly growing line in an array, and then display it.  The line is continuous but in the output, there are segments missing from it.  Of course, if I zoom into the picture (before saving to output), then I can see the lines.  However, if I save directly to a file then the segments are missing.

Here is a minimal example:

"""
import numpy as np
import matplotlib.pyplot as plt

N = 600
slope = 15
x = np.zeros((N,N))
j = np.arange(N)
i = N/2 - j/slope
for idx in zip(i,j):
    x[idx] = 1
    
plt.imshow(x, interpolation='nearest', cmap=plt.cm.gray_r)
plt.savefig('bug.pdf')
plt.savefig('bug.png')
"""

I have attached an example of the output.  In theory, there should be a continuous line from the left side of the picture to the right side.  The problem seems to occur across backends.  Additionally, the thickness of the segments is not uniform.  Some are thinner than the rest.   Decreasing the value of N seems to make the issue go away.  Increasing the value of N makes the problem worse.

Any ideas on what is going on and how I can fix it?
Attachment (bug.pdf): application/pdf, 32 KiB
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Ted To | 8 Feb 20:12
Picon
Gravatar

plot_date again

Hi,

Is it possible to force the date ticks to be the same in two different
plots?  For example, the attached figures cover the same time spans but
in one, the data are weekly and the other, monthly.  While there is
nothing really wrong with different tick marks, aesthetically it would
be nice if they were both the same.

Thanks,
Ted
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chris | 8 Feb 18:06
Picon
Gravatar

use the github version on a linux box

I was trying to test the patch mike put in to fix the single pixel
plotting issue, but just realized that this was a Mac version.  Can I
use it on a linux box? How?

Thanks,
Chris

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Ted To | 8 Feb 15:47
Picon
Gravatar

Strange plot_date problem

Hi,

I'm experiencing a very strange problem with plot_date that I can't
figure out.

    pyplot.plot_date(pylab.date2num(dates),diff,'b-',label='Chained')
    pyplot.show()

dates, naturally, is a list of dates and diff is an array of floats.
With my script, this fails.  But if I interactively enter dates and diff
and then type the above commands, it works with no problems.  Any ideas
or suggestions?

The traceback follows.

Thanks,
Ted

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 245, in resize
    self.show()
  File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 248, in draw
    FigureCanvasAgg.draw(self)
  File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line
394, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 798, in
draw
    func(*args)
  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1946, in draw
    a.draw(renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 971, in draw
    tick_tups = [ t for t in self.iter_ticks()]
  File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 904, in
iter_ticks
    majorLocs = self.major.locator()
  File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 743, in
__call__
    self.refresh()
  File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 752, in
refresh
    dmin, dmax = self.viewlim_to_dt()
  File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 524, in
viewlim_to_dt
    return num2date(vmin, self.tz), num2date(vmax, self.tz)
  File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 289, in
num2date
    if not cbook.iterable(x): return _from_ordinalf(x, tz)
  File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 203, in
_from_ordinalf
    dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
David Craig | 8 Feb 15:42
Picon

add a single x tick label

Hi, I have a plot of a time series and I would like to add a single 
extra tick mark and label to the plot in a different color to the 
already existing tick marks. Is this possible??
Thanks,
D

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Martin Mokrejs | 7 Feb 19:01
Picon

How to make a colored bar chart with named items and values shown above each bar?

Hi,
  I would like to create a bar chart like the attached example but with the addition
that each bar would have a different color. I tried to learn this from the examples
on matplotlib web but still do not see a close example for that. ;-)
many thanks,
Martin
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Gökhan Sever | 7 Feb 17:40
Picon
Gravatar

Partial coloring of text in matplotlib

Is there a way in matplotlib to partially specify the color of a string?

Example:

plt.ylabel("Today is cloudy.")
How can I show "today" as red, "is" as green and "cloudy." as blue?

Thanks.


--
Gökhan
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Fabien Lafont | 7 Feb 15:33
Picon

[matplotlib-users] Is it possible to set .pdf as defaut when saving an image?

Is it possible to set the extension .pdf as defaut when I save an
image using the matplotlib bar. My coworkers are always saving the
image in png and it's really ugly!

Thx,

Fab

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

Gmane