You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(1) |
2
(8) |
3
(10) |
4
|
|
5
(4) |
6
|
7
(5) |
8
(6) |
9
(4) |
10
(12) |
11
(7) |
|
12
(2) |
13
(2) |
14
(5) |
15
(9) |
16
(4) |
17
(7) |
18
(2) |
|
19
(12) |
20
(8) |
21
(11) |
22
(11) |
23
(2) |
24
(18) |
25
(18) |
|
26
(6) |
27
(7) |
28
(10) |
29
(7) |
30
(31) |
31
(10) |
|
|
From: satish m. <mau...@gm...> - 2012-08-10 08:39:51
|
Dear All, I want to stairs plot (similar in matlab) matplotlib First i want for i data-set then multiple data-set super impose on that. I attach the figure it's showing velocity-depth stairs plots for superimpose (like hold on in matlab) large data-set. can anybody tell me how to plot that. see the figure Thank you -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *Satish Maurya* *Research Scholar* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
From: Mark B. <ma...@gm...> - 2012-08-09 18:43:31
|
I am glad to see you can reproduce the error, Stan. I am running whatever is default with a PythonXY installation (sorry my windows machine is at work). Strange behavior. The code works fine on my mac (PyQt4 backend) with all options (show,draw,pause). Should we file a bug report? Mark On Thu, Aug 9, 2012 at 4:02 PM, Stan West <sta...@nr...> wrote: > ** > > *From:* Mark Bakker [mailto:ma...@gm...] > *Sent:* Tuesday, August 07, 2012 06:42 > > I tried a few things and found out that doing a pause works. > So why does a pause work, but a draw() or show() does not? > This all on Windows using the standard PythonXY installation. > Here is the code that works (testimage.py): > > from pylab import * > c = ones((10,20)) > ax = imshow(c) > pause(0.01) > print ax.get_axes().get_position() > > Running from IPython: > run testimage > Bbox(array([[ 0.125 , 0.24166667], > [ 0.9 , 0.75833333]])) > > I modified your script to test show(), draw(), and pause(); it's attached. > For the WXAgg matplotlib backend, I get: > > In [1]: print(matplotlib.get_backend()) > WXAgg > > In [2]: %run testimage > show: Bbox(array([[ 0.125, 0.1 ], > [ 0.9 , 0.9 ]])) > draw: Bbox(array([[ 0.125 , 0.24166667], > [ 0.9 , 0.75833333]])) > pause: Bbox(array([[ 0.125 , 0.24166667], > [ 0.9 , 0.75833333]])) > > but for the Qt4Agg backend, I get: > > In [1]: print(matplotlib.get_backend()) > Qt4Agg > > In [2]: %run testimage > show: Bbox(array([[ 0.125, 0.1 ], > [ 0.9 , 0.9 ]])) > draw: Bbox(array([[ 0.125, 0.1 ], > [ 0.9 , 0.9 ]])) > pause: Bbox(array([[ 0.125 , 0.24166667], > [ 0.9 , 0.75833333]])) > > Which backend have you been using? > |
|
From: Yasin S. B. <yas...@gm...> - 2012-08-09 14:58:05
|
Hi.
i wanted to make a colorbar for a dataset. dataset has 50 different values.
so instead of entering a different color for 50 values one by one, i tried
the code below.
here is what happens:
1- two different data value is painted same color.
changing the color number to some value, sometimes works, sometimes doesnt.
for example, if i change the N (number of colors) in the code below, from
50 to 52,
problem continues, but with different indices. (29-30) are same instead of
(28-29).
but if i change it to 60 colors, problem "seems to" go away for given data
values in the example.
2- colors in image are not "exactly" taken from colorbar. they are
different a tiny bit.
if you check that darkblue color color picker, there is no such color in
colorbar!
second 'data' line (RGB 21-1-167)
the most close one is color index 28 (RGB 22-2-168)
and even correctly indexed data colors are off a little bit (RGB-values, i
mean).
PS: since colors are very similar and look same, you need to use
a RGB color picker/finder app. (i use Color Selector 1.0)
thanks in advance.
#
===========================================================================
from matplotlib import colors, colorbar, pyplot
import numpy as np
# make a dict for colors.
color_info = {}
color_info["red"] = [[0.0, 0.00, 0.00], # black
[0.2, 0.40, 0.40], # brown
[0.4, 0.60, 0.60], # purple
[0.6, 0.00, 0.00], # darkblue
[0.7, 0.00, 0.00], # green
[0.8, 1.00, 1.00], # yellow
[0.9, 1.00, 1.00], # red
[1.0, 1.00, 1.00]] # white
color_info["green"] = [[0.0, 0.00, 0.00],
[0.2, 0.20, 0.20],
[0.4, 0.05, 0.05],
[0.6, 0.00, 0.00],
[0.7, 1.00, 1.00],
[0.8, 1.00, 1.00],
[0.9, 0.00, 0.00],
[1.0, 1.00, 1.00]]
color_info["blue"] = [[0.0, 0.00, 0.00],
[0.2, 0.00, 0.00],
[0.4, 0.70, 0.70],
[0.6, 0.65, 0.65],
[0.7, 0.00, 0.00],
[0.8, 0.00, 0.00],
[0.9, 0.18, 0.18],
[1.0, 1.00, 1.00]]
# divide colorbar into 50 colors. you can change this (Ex: N=15 and use
data2)
my_cmap = colors.LinearSegmentedColormap('my_colormap', color_info, N=50)
N = my_cmap.N
# we put tickmarks into the middle of colors, by shifting half a segment.
ticklabels = np.arange(N)
ind = np.arange(N)
ticks = [(i / float(N)) + (1 / float(2 * N)) for i in ind]
def my_cbar(cbar_ax, cmap=my_cmap):
"""adds cbar to image."""
base = colorbar.ColorbarBase(cbar_ax, cmap=my_cmap,
ticks=ticks,
orientation="horizontal")
xlabels = cbar_ax.get_xticklabels()
for label in xlabels:
label.set_rotation(60)
base.set_ticklabels(ticklabels)
# labels are very close so dont forget to maximize plot window to see
better.
fig = pyplot.figure(figsize=(7, 7))
data = [[27, 28],
[28, 29], # both are same colors!
[29, 30],
[30, 31],
[31, 32],
[32, 33]]
# data2 is just to show it works as expected for N=15.
data2 = [[7.999, 8],
[8.999, 9],
[9.999, 10],
[10, 11],
[11, 12],
[12, 13]]
# with these vmin/vmax, data value 0-0.99999 goes to 'color index 0',
# data value X - X.9999 goes to 'color index X' ...etc
# (change 'data' to 'data2' when N=15)
pyplot.imshow(data, cmap=my_cmap,
vmin=0, vmax=N, interpolation="nearest")
cx = fig.add_axes((0.2, 0.05, 0.6, 0.03))
my_cbar(cx, cmap=my_cmap)
# but data values 28 and 29 goes to same color. maybe this happens for other
# data values as well ???
# similarly interesting, if you check that darkblue color with a
# rgb color picker/reader, there is no such color in colorbar! the most
close
# one is color index 28.
# RGB values ->>> 'data[1, :]=(21, 1, 167)' vs 'color index 28=(22, 2, 168)'
# and even correctly indexed colors RGB values are off a little bit.
pyplot.show()
--
Yasin Selçuk Berber
"Bismillah, her hayrın başıdır."
|
|
From: Benjamin R. <ben...@ou...> - 2012-08-09 14:34:52
|
On Wed, Aug 8, 2012 at 7:03 AM, darkside <in....@gm...> wrote: > > > ---------- Forwarded message ---------- > From: darkside <in....@gm...> > Date: 2012/8/2 > Subject: Re: [Matplotlib-users] zoomed in detail box > To: Jae-Joon Lee <lee...@gm...> > > > Hi everyone! > > I'm also trying to do a detailed zoomed area of my plot, but I can't > manage to put the box in the position I want, bbox_to_anchor didn't work in > my case: > > axins = > zoomed_inset_axes(ax,3,loc=2,bbox_to_anchor=(0,0,0.5,0.5),bbox_transform=ax.transAxes) > > This bbox_to_anchor tuple is just an example. I only want to move the > zoomed box a little to the right, since the ticklabels overlap. > > Any idea? > > I really appreciate your help! > > Is this what you are looking for? http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator Cheers! Ben Root |
|
From: Stan W. <sta...@nr...> - 2012-08-09 14:02:32
|
From: Mark Bakker [mailto:ma...@gm...]
Sent: Tuesday, August 07, 2012 06:42
I tried a few things and found out that doing a pause works.
So why does a pause work, but a draw() or show() does not?
This all on Windows using the standard PythonXY installation.
Here is the code that works (testimage.py):
from pylab import *
c = ones((10,20))
ax = imshow(c)
pause(0.01)
print ax.get_axes().get_position()
Running from IPython:
run testimage
Bbox(array([[ 0.125 , 0.24166667],
[ 0.9 , 0.75833333]]))
I modified your script to test show(), draw(), and pause(); it's attached. For
the WXAgg matplotlib backend, I get:
In [1]: print(matplotlib.get_backend())
WXAgg
In [2]: %run testimage
show: Bbox(array([[ 0.125, 0.1 ],
[ 0.9 , 0.9 ]]))
draw: Bbox(array([[ 0.125 , 0.24166667],
[ 0.9 , 0.75833333]]))
pause: Bbox(array([[ 0.125 , 0.24166667],
[ 0.9 , 0.75833333]]))
but for the Qt4Agg backend, I get:
In [1]: print(matplotlib.get_backend())
Qt4Agg
In [2]: %run testimage
show: Bbox(array([[ 0.125, 0.1 ],
[ 0.9 , 0.9 ]]))
draw: Bbox(array([[ 0.125, 0.1 ],
[ 0.9 , 0.9 ]]))
pause: Bbox(array([[ 0.125 , 0.24166667],
[ 0.9 , 0.75833333]]))
Which backend have you been using?
|
|
From: Daniel H. <dh...@gm...> - 2012-08-08 23:23:16
|
I was wanting to allow the specification of the size of the box used to
enclose the text in an annotation, rather than allowing it to always fit
exactly to the text. I know that I could always just draw a rectangle, and
then text on top, but I was wanting to also be able to drag thing thing
around on the graph, in which case it is much more straightforward to keep
the text and rectangle together, just like the annotation does.
So my first attempt at drawing the box according to a set size looks like
the attached code: in text.py, I inserted some code into Text._draw_bbox().
So long as the annotation has an attribute bbox_size that exists, it's
used for the size of the box. Very straightforward, *but* it doesn't
survive a text rotation like an annotation (see attached images). I have
no clue what I'm doing wrong, and I will also have to confess a lot of
ignorance when it comes to matplotlib's transforms, mutations, and such.
I've been fiddling with this for hours with no success, and it seems that
it should be simple :(
def _draw_bbox(self, renderer, posx, posy):
""" Update the location and the size of the bbox
(FancyBoxPatch), and draw
"""
x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
#======================my extra code ===============================
# self._get_xy is annotation specific.
# self.textcoords is annotation specific.
x_box_orig,y_box_orig = x_box,y_box
if getattr(self,'bbox_size',None):
bx,by = self.bbox_size
pt0 = self._get_xy(renderer,0.0,0.0,self.textcoords)
pt1 = self._get_xy(renderer,bx,0.0,self.textcoords)
pt2 = self._get_xy(renderer,0.0,by,self.textcoords)
bx = pt1[0]-pt0[0]
by = pt2[1]-pt0[1]
xc = x_box + w_box/2
yc = y_box + h_box/2
x_box = xc - bx/2
y_box = yc - by/2
w_box = bx
h_box = by
#================================================================================
self._bbox_patch.set_bounds(0., 0.,
w_box, h_box)
theta = self.get_rotation()/180.*math.pi
tr = mtransforms.Affine2D().rotate(theta)
tr = tr.translate(posx+x_box, posy+y_box)
self._bbox_patch.set_transform(tr)
fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
self._bbox_patch.draw(renderer)
--
Daniel Hyams
dh...@gm...
|
|
From: Warren W. <war...@en...> - 2012-08-08 22:37:10
|
On Wed, Aug 8, 2012 at 3:34 PM, Gustavo Goretkin <gus...@gm... > wrote: > I can use the scatter function to plot an array of points and give a > corresponding array of colors to set those points. Is it possible to > do the same thing with alpha values? > > Right now, I'm restoring to calling plot with an 'o' marker for each > individual point, which is slow. > > The 'color' argument of the 'scatter' function can take an array of (r,g,b,alpha) values: In [23]: x = array([0, 1, 2, 3]) In [24]: y = array([0, 1, 1, 2]) In [25]: c = array([[0,0,1,1], [0,0,1,0.5], [0,1,0,0.5], [1,0,1,.9]]) In [26]: scatter(x, y, color=c) Out[26]: <matplotlib.collections.PathCollection at 0x898adf0> Warren > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Damon M. <dam...@gm...> - 2012-08-08 21:49:30
|
On Wed, Aug 08, 2012 at 05:22:49PM -0400, Tony Yu wrote: > On Wed, Aug 8, 2012 at 4:34 PM, Gustavo Goretkin <gus...@gm... > > wrote: > > > I can use the scatter function to plot an array of points and give a > > corresponding array of colors to set those points. Is it possible to > > do the same thing with alpha values? > > > You can use a colormap with varying alpha values. Would it be possible to do something like ax.plot(x, y, color=[c1, c2, c3], alpha=[a1, a2, a3])? It doesn't seem that it's supported and that would be the 'natural' extension, in some sense. -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom |
|
From: Tony Yu <ts...@gm...> - 2012-08-08 21:23:35
|
On Wed, Aug 8, 2012 at 4:34 PM, Gustavo Goretkin <gus...@gm...
> wrote:
> I can use the scatter function to plot an array of points and give a
> corresponding array of colors to set those points. Is it possible to
> do the same thing with alpha values?
>
> Right now, I'm restoring to calling plot with an 'o' marker for each
> individual point, which is slow.
>
>
You can use a colormap with varying alpha values.
Example below. I'm not a huge fan of the call signature of
`LinearSegmentedColormap`, so I've included a class that makes it a little
more convenient to define the colormap.
Cheers,
-Tony
P.S. There were some major cleanups of the alpha handling not too long ago,
but I don't think those are necessary for scatter. Let me know if this
doesn't work for some reason.
#~~~ example code
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
class LinearColormap(LinearSegmentedColormap):
def __init__(self, name, segmented_data, index=None, **kwargs):
if index is None:
# If index not given, RGB colors are evenly-spaced in colormap.
index = np.linspace(0, 1, len(segmented_data['red']))
for key, value in segmented_data.iteritems():
# Combine color index with color values.
segmented_data[key] = zip(index, value)
segmented_data = dict((key, [(x, y, y) for x, y in value])
for key, value in segmented_data.iteritems())
LinearSegmentedColormap.__init__(self, name, segmented_data,
**kwargs)
# Red for all values, but alpha changes linearly from 0.3 to 1
color_spec = {'blue': [0.0, 0.0],
'green': [0.0, 0.0],
'red': [0.8, 0.8],
'alpha': [0.3, 1.0]}
alpha_red = LinearColormap('alpha_red', color_spec)
x, y, z = np.random.normal(size=(3, 100))
plt.scatter(x, y, c=z, cmap=alpha_red, s=50, edgecolors='none')
plt.show()
# Here's a slightly more complicated use of LinearColormap, if you're
interested.
# Blue below midpoint of colormap, red above mid point.
# Alpha maximum at the edges, minimum in the middle.
bwr_spec = {'blue': [0.4, 0.4, 0.1, 0.1],
'green': [0.2, 0.2, 0.0, 0.0],
'red': [0.02, 0.02, 0.4, 0.4],
'alpha': [1, 0.3, 0.3, 1]}
blue_white_red = LinearColormap('blue_white_red', bwr_spec,
index=[0, 0.5, 0.5, 1])
|
|
From: Gustavo G. <gus...@gm...> - 2012-08-08 20:35:10
|
I can use the scatter function to plot an array of points and give a corresponding array of colors to set those points. Is it possible to do the same thing with alpha values? Right now, I'm restoring to calling plot with an 'o' marker for each individual point, which is slow. |
|
From: darkside <in....@gm...> - 2012-08-08 11:03:57
|
---------- Forwarded message ---------- From: darkside <in....@gm...> Date: 2012/8/2 Subject: Re: [Matplotlib-users] zoomed in detail box To: Jae-Joon Lee <lee...@gm...> Hi everyone! I'm also trying to do a detailed zoomed area of my plot, but I can't manage to put the box in the position I want, bbox_to_anchor didn't work in my case: axins = zoomed_inset_axes(ax,3,loc=2,bbox_to_anchor=(0,0,0.5,0.5),bbox_transform=ax.transAxes) This bbox_to_anchor tuple is just an example. I only want to move the zoomed box a little to the right, since the ticklabels overlap. Any idea? I really appreciate your help! 2009/7/10 Jae-Joon Lee <lee...@gm...> > On Thu, Jul 9, 2009 at 7:24 AM, Robin<ro...@gm...> wrote: > >> On Wed, Jul 8, 2009 at 10:57 PM, Jae-Joon Lee<lee...@gm...> > wrote: > >>> If you use the svn version of matplotlib, you may use axes_grid > toolkit. > >>> > >>> > http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator > > > > Wow - this is really amazing. Sometimes it can be a bit frustrating > > when I'm working to a deadline to figure out the details of Bbox's and > > such but when I find something like this it really makes it worth > > while! It does exactly what I want, really easy to use and only took > > about 5 lines! (It would be nice if there were some docstrings in > > there though :)) > > > > On Thu, Jul 9, 2009 at 4:02 AM, Jae-Joon Lee<lee...@gm...> > wrote: > >> However, It is possible to specify the location of the axes in > >> normalized axes coordinate. > >> > >> http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373 > > > > I'm afraid I didn't really understand how to apply this in my case... > > I guess I would have to set the position and everything by hand > > instead of using the zoom helper. I preferred to use the zoom helper, > > but found the legend loc settings put it slightly too close to the > > edge of the surrounding axes for my taste. > > > > So after checking the docstrings for how to position legends I came up > > with something that works, but it required a minor change to the > > inset_locator.py to pass the bbox_to_anchor and bbox_transform (it > > looks like this was intended since they have None default values): > > > > robin-mbp-3:~ robince$ diff > > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mpl_toolkits/axes_grid/inset_locator.py > > code/scipy_build/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py > > 288c288 > > < axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, > > loc=loc, bbox_to_anchor=bbox_to_anchor,bbox_transform=bbox_transform) > > --- > >> axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc) > > > > With this minor change I get exactly what I want! > > > > Thanks for the catch. I'll commit the change to the svn soon. > By the way, borderpad keyword is meant to do what you want. However, I > just found that it does not work sine the option is not properly > handled. I'll fix this in the next commit. > > Regards, > > -JJ > > > > ax1ins = zoomed_inset_axes(ax1, 3, > > bbox_to_anchor=(0.1,0,1,1),bbox_transform=ax1.transAxes, loc=6) > > plot_trial_dists(res515[0],8,ax=ax1ins) > > ax1ins.set_xlim([5, 50]) > > ax1ins.set_ylim([0, 0.04]) > > ax1ins.set_xticks([]) > > ax1ins.set_yticks([]) > > mark_inset(ax1, ax1ins, loc1=2, loc2=4, fc="none", ec="0.5") > > > > thanks again, this is really terrific! > > > > Cheers > > > > Robin > > > > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Qian P. <qia...@gm...> - 2012-08-07 17:58:35
|
Hi,
In matplotlib, is there a way to check whether a window related to a
figure has been closed by user?
x=[1,2,3]
fig = plt.figure()
fig.show()
plt.plot(x,x)
plt.draw()
later in the code, I want to make draw some other line, possibly on the
same figure. I can switch to the preivious figure by
plt.figure(fig.number)
but it seems that even if fig has been closed by the user, this will still
work because the information stored in fig is still accessible. Then, this
fig.number would actually point some other picture.
So, is there any state information in fig that would tell whether the
window of fig has been closed by user?
Thanks
Qian
|
|
From: darkside <in....@gm...> - 2012-08-07 10:48:06
|
Hi everyone,
I'm trying to make a zoom of a single plot. The problem is that the zoomed
axes yticks overlap with the yaxes so I tried to use the bbox_to_anchor
option in the zoom:
axins = zoomed_inset_axes(ax,
3,bbox_to_anchor=(0.4,0.4),bbox_transform=ax.transAxes, loc=2)
with different (x,y) parameters, but it's not working.
I also tried to move the figure by hand:
box = axins.get_position()
print box
axins.set_position([box.x0+0.5, box.y0,box.width, box.height])
box = axins.get_position()
print box
and I see that box numbers changing, but not in the plot.
Can anyone guess what I am doing wrong?
Thank you all!
PS: The full code for this plot is:
def plotvsdata(data,z,dl,nu):
"""
Plot of z vs. Dl for different nu values
"""
fig = p.figure(figsize=(12,8))
ax = p.subplot(111)
# FLRW light distance
ax.plot(z[0],Dl_lflrw(z[0],0.3,0.7),'k--',label=r'Dl $\Lambda$FLRW')
# mean data values
ax.plot(data.redshift,data.distance,'r.',label='SCP data')
p.xlabel('z',fontsize=18)
p.ylabel('Luminosity distance',fontsize=18)
p.grid(True)
#axins = zoomed_inset_axes(ax,3,loc=2,bbox_to_anchor=(0.5,0.5))
#axins = zoomed_inset_axes(ax,3,loc=2,bbox_to_anchor=(0.4,0.4)
,bbox_transform=ax.transAxes)
axins = zoomed_inset_axes(ax,
3,bbox_to_anchor=(1,1),bbox_transform=ax.transAxes, loc=2)
#box = axins.get_position()
#print box
#axins.set_position([box.x0+0.5, box.y0,box.width, box.height])
#box = axins.get_position()
#print box
# Kantowski equation
for i in range(len(z)):
ax.plot(z[i],dl[i],label=r'$\nu={0:1.2f}$'.format(nu[i]))
axins.plot(z[i],dl[i])
axins.plot(data.redshift,data.distance,'r.', label='SCP data')
#box = ax.get_position()
#ax.set_position([box.x0,box.y0,box.width*0.8,box.height])
ax.legend(loc=2,bbox_to_anchor=(1,1))
x,y = (0.86,1.3)
x2,y2 = (1,1.7)
axins.set_xlim(x,x2)
axins.set_ylim(y,y2)
axins.tick_params(axis='both',labelsize=12)
axins.xaxis.set_major_locator(MaxNLocator(2))
axins.yaxis.set_major_locator(MaxNLocator(3))
#box = axins.get_position()
#print box
#axins.set_position([box.x0+0.5, box.y0,box.width, box.height])
#box = axins.get_position()
#print box
# draw a bbox of the region to zoom and connecting lines between it
# and the zoomed box.
mark_inset(ax,axins,loc1=1,loc2=3, fc="none", ec="0.5")
#p.xticks(visible=False)
#p.yticks(visible=False)
p.draw()
p.show()
|
|
From: Mark B. <ma...@gm...> - 2012-08-07 10:42:04
|
I tried a few things and found out that doing a pause works.
So why does a pause work, but a draw() or show() does not?
This all on Windows using the standard PythonXY installation.
Here is the code that works (testimage.py):
from pylab import *
c = ones((10,20))
ax = imshow(c)
pause(0.01)
print ax.get_axes().get_position()
Running from IPython:
run testimage
Bbox(array([[ 0.125 , 0.24166667],
[ 0.9 , 0.75833333]]))
On Wed, Aug 1, 2012 at 8:56 PM, Stan West <sta...@nr...> wrote:
> **
>
> *From:* Mark Bakker [mailto:ma...@gm...]
> *Sent:* Monday, July 30, 2012 05:54
>
> Hello List,
>
> I am trying to determine the position of the axes after an imshow and am
> having problems.
> I get a different answer on my Mac (the correct answer) than Windows (the
> wrong answer).
>
> [...]
>
> Any thoughts? When I type the commands in at the IPython prompt it works
> most of the time (on Windows), but it never works when running the file.
> What in the world could be different?
>
> mp version 1.1.0 on both systems.
>
> Are you using the same backend on both systems?
>
> Perhaps when you run the script within IPython on your Windows system, the
> show() call is not triggering a draw. You can force drawing by calling
> draw() before show(). I hope that helps.
>
|
|
From: Scott S. <sco...@gm...> - 2012-08-07 06:50:17
|
On 7 August 2012 03:10, Jeff Whitaker <js...@fa...> wrote: > Available for download at > https://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.5/ Just a note to anyone experiencing problems building against GEOS 3.3.3 installed from the ubuntu-gis-unstable PPA on Ubuntu. The naming convention for the GEOS shared library has changed and I had to apply the patch below as a workaround: diff --git a/setup.py b/setup.py index 216ddf6..dc6d916 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ else: library_dirs=geos_library_dirs, runtime_library_dirs=geos_library_dirs, include_dirs=geos_include_dirs, - libraries=['geos_c','geos'])) + libraries=['geos_c','geos-3.3.3'])) # Specify all the required mpl data # create pyproj binary datum shift grid files. Apparently this is an acceptable practice on Debian systems (http://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-shlibs), but no time to dream up a more robust fix right now.. Cheers, Scott |
|
From: Jeff W. <js...@fa...> - 2012-08-07 01:10:21
|
Available for download at https://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/basemap-1.0.5/ Thanks to Christoph Gohlke for making windows installers. Highlights: - new 'latlon' keyword for contour,contourf,pcolor,pcolormesh,quiver,barb methods that automatically converts x, y from longitude/latitude to map projection coordinates, and for global projections shifts the data longitudinally to fit in map projection region (see shiftdata.py example). - fixed a serious bug that caused a bogus mask to be applied to the data when the contour method was called (did not affect contourf). full Changelog: version 1.0.5 (git tag v1.0.5rel) -------------------------------- * fix bug triggered when drawlsmask method called more than once. * fix error in contour method that caused a bogus mask to be applied to the data (issue 58). * fix further corner cases with splitting of parallels that cross the dateline (issue 40). * add latlon keyword to plotting methods. If latlon=True, x and y values are assumed to longitudes and latitudes in degrees. The data and longitudes are shifted to the map projection region (for cylindrical and pseudo-cylindrical projections) using the shiftdata method, and lons/lats are converted to map projection coords. Default value is False. Addresses issue 54. New example shiftdata.py added to illustrate usage. * fix bluemarble and warpimage methods to account for change in orientation of arrays returned to matplotlib's pil_to_array (issue 51) * fix glitch with drawing meridians and filling coastline polygons with omerc projection that includes pole. Regards, Jeff |
|
From: Benjamin R. <ben...@ou...> - 2012-08-05 18:55:35
|
On Sunday, August 5, 2012, Nikolaus Rath wrote: > Benjamin Root <ben...@pu... <javascript:;>> > writes: > > On Sunday, August 5, 2012, Nikolaus Rath wrote: > > > >> Hello, > >> > >> The following code shows the plot right away as expected: > >> > >> # python > >> Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > >> [GCC 4.6.3] on linux2 > >> Type "help", "copyright", "credits" or "license" for more information. > >> >>> import matplotlib > >> >>> matplotlib.__version__ > >> '1.1.1rc2' > >> >>> import matplotlib.pyplot as plt > >> >>> plt.interactive(True) > >> >>> plt.plot(range(10)) > >> [<matplotlib.lines.Line2D object at 0x2ce7790>] > >> > >> > >> This, however, opens a window but the graph never shows up: > >> > >> # python > >> Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > >> [GCC 4.6.3] on linux2 > >> Type "help", "copyright", "credits" or "license" for more information. > >> >>> import matplotlib.pyplot as plt > >> >>> plt.interactive(True) > >> >>> fig = plt.figure() > >> >>> ax = fig.add_subplot(1,1,1) > >> >>> ax.plot(range(10)) > >> [<matplotlib.lines.Line2D object at 0x3055d90>] > >> >>> > >> > >> Does interactive mode only apply to the plot commands in pyplot? > >> > >> Is there a method I can call in this case to "refresh" the window and > >> show the plot? > >> > >> For seem reason, calling plt.axes() has the desired effect, but this is > >> probably a side effect that I really should not rely on, right? > > > > Correct, I think you want plt.draw(). > > Thanks, that works! But why is it necessary? Does interactive mode only > apply to direct pyplot.* commands? > > > Thanks, > > -Nikolaus Not quite. It is that the pyplot commands have a "draw_if_interactive" call as a final step. This way, matplotlib can defer drawing until it is really needed. This improves responsiveness. When in OO mode, the training wheels come off and the developer is responsible for issuing draw() calls when they need to. Cheers! Ben Root |
|
From: Nikolaus R. <Nik...@ra...> - 2012-08-05 16:32:59
|
Benjamin Root <ben...@pu...> writes: > On Sunday, August 5, 2012, Nikolaus Rath wrote: > >> Hello, >> >> The following code shows the plot right away as expected: >> >> # python >> Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) >> [GCC 4.6.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import matplotlib >> >>> matplotlib.__version__ >> '1.1.1rc2' >> >>> import matplotlib.pyplot as plt >> >>> plt.interactive(True) >> >>> plt.plot(range(10)) >> [<matplotlib.lines.Line2D object at 0x2ce7790>] >> >> >> This, however, opens a window but the graph never shows up: >> >> # python >> Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) >> [GCC 4.6.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import matplotlib.pyplot as plt >> >>> plt.interactive(True) >> >>> fig = plt.figure() >> >>> ax = fig.add_subplot(1,1,1) >> >>> ax.plot(range(10)) >> [<matplotlib.lines.Line2D object at 0x3055d90>] >> >>> >> >> Does interactive mode only apply to the plot commands in pyplot? >> >> Is there a method I can call in this case to "refresh" the window and >> show the plot? >> >> For seem reason, calling plt.axes() has the desired effect, but this is >> probably a side effect that I really should not rely on, right? > > Correct, I think you want plt.draw(). Thanks, that works! But why is it necessary? Does interactive mode only apply to direct pyplot.* commands? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
|
From: Benjamin R. <ben...@ou...> - 2012-08-05 15:58:45
|
On Sunday, August 5, 2012, Nikolaus Rath wrote: > Hello, > > The following code shows the plot right away as expected: > > # python > Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib > >>> matplotlib.__version__ > '1.1.1rc2' > >>> import matplotlib.pyplot as plt > >>> plt.interactive(True) > >>> plt.plot(range(10)) > [<matplotlib.lines.Line2D object at 0x2ce7790>] > > > This, however, opens a window but the graph never shows up: > > # python > Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib.pyplot as plt > >>> plt.interactive(True) > >>> fig = plt.figure() > >>> ax = fig.add_subplot(1,1,1) > >>> ax.plot(range(10)) > [<matplotlib.lines.Line2D object at 0x3055d90>] > >>> > > Does interactive mode only apply to the plot commands in pyplot? > > Is there a method I can call in this case to "refresh" the window and > show the plot? > > For seem reason, calling plt.axes() has the desired effect, but this is > probably a side effect that I really should not rely on, right? > > > Thanks! > > -Nikolaus Correct, I think you want plt.draw(). Cheers! Ben Root |
|
From: Nikolaus R. <Nik...@ra...> - 2012-08-05 15:52:35
|
Hello, The following code shows the plot right away as expected: # python Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib >>> matplotlib.__version__ '1.1.1rc2' >>> import matplotlib.pyplot as plt >>> plt.interactive(True) >>> plt.plot(range(10)) [<matplotlib.lines.Line2D object at 0x2ce7790>] This, however, opens a window but the graph never shows up: # python Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib.pyplot as plt >>> plt.interactive(True) >>> fig = plt.figure() >>> ax = fig.add_subplot(1,1,1) >>> ax.plot(range(10)) [<matplotlib.lines.Line2D object at 0x3055d90>] >>> Does interactive mode only apply to the plot commands in pyplot? Is there a method I can call in this case to "refresh" the window and show the plot? For seem reason, calling plt.axes() has the desired effect, but this is probably a side effect that I really should not rely on, right? Thanks! -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
|
From: Joshua K. <jjk...@gm...> - 2012-08-03 19:26:35
|
Hi all,
I am creating a GUI using wxPython and Matplotlib. In it, I am trying to
delete an axis in a figure and then adding another axis to the same figure.
In essence, I am attempting to dynamically update the figure. I am using
pylab.figure.
I am using the figure.delaxes function to delete the desired axes. That
works fine. I am then changing the geometry of the rest of the axes to
update the display. Afterwards, I am trying to append a new axes to the end
after updating the other axes (once again using change_geometry).
Pseudocode:
- delete the selected axis using figure.delaxes(axis)
- update the rest of the axes using change_geometry
- when it is time to add a new axis
-update the current axes using change_geometry
-add a subplot to the end
This approach works fine if the axes that was deleted was the axis on the
end (the last one). If the deleted axis was in the middle or beginning then
the figure.add_subplot(...) does not add an axis to the figure. Instead, it
returns the previous axis. So if there were two axes left when one axis in
the middle was deleted, ie. [axis1, axis2], figure.add_subplot would return
axis2 and so the axes list would still be [axis1, axis2]
This occurs both in the GUI and when run interactively via PyCrust.
Any thoughts on to why this would happen?
python 2.7
matplotlib version: 1.1.0
OS X 10.6.8
|
|
From: surfcast23 <sur...@gm...> - 2012-08-03 04:40:43
|
Gotcha ya working perfectly now thank you for the help! Benjamin Root-2 wrote: > > On Thursday, August 2, 2012, surfcast23 wrote: > >> >> Wouldn't >> >> X= np.ones((1, 45)) >> Y= np.zeros((32, 1)) >> >> change the existing values of the elements to ones and zeros? >> >> > I was just demonstrating what np.broadcast_arrays() does. Take your x and > y arrays and put them through this function and put the outputs into > plot_wireframe(). Ignore the ones() and zeros(). > > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe%28X%2C-Y%2C-Z%2C-*args%2C-**kwargs%29-tp34243823p34249265.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Benjamin R. <ben...@ou...> - 2012-08-03 04:28:15
|
On Friday, August 3, 2012, surfcast23 wrote: > > I tested it out and it does change all the values to ones and zeros. Is > there > a way to broadcast and keep the original values that were in the arrays? > Thanks for the help > > > Don't use ones() and zeros(). It was just a way to swtup a demonstration since I dont have your data. Use your data instead of my ones() and zeros(). Also, it would be more useful to post your latest version of your code that is causing problems so that we can double-check it, rather than guessing what the problem is. Cheers! Ben Root |
|
From: surfcast23 <sur...@gm...> - 2012-08-03 04:03:11
|
I tested it out and it does change all the values to ones and zeros. Is there a way to broadcast and keep the original values that were in the arrays? Thanks for the help Benjamin Root-2 wrote: > > On Thursday, August 2, 2012, surfcast23 wrote: > >> >> Okay thank you! The Matlab code I am basing this on takes arrays of >> different >> shapes with different sized elements ie >> x = 1 512 >> y = 101 1 >> and I guess automatically makes the the same shape. Can you point me in >> the >> direction of documentation that will explain how I can do this in Python? >> >> > Ok, I just double-checked the source for plot_wireframe(). It does not > perform any broadcasting (which I consider to be a bug). > > Until it is fixed, you will have to do the broadcasting yourself: > > X= np.ones((1, 45)) > Y= np.zeros((32, 1)) > x, y = np.broadcast_arrays(X, Y) > > Which produces x and y with the same shapes, and their values duplicated > in > the direction the array was "expanded". > > Pass those into plot_wireframe(). > > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Size-of-array-elements-when-using-Axes3D.plot_wireframe%28X%2C-Y%2C-Z%2C-*args%2C-**kwargs%29-tp34243823p34249203.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Benjamin R. <ben...@ou...> - 2012-08-03 03:54:08
|
On Thursday, August 2, 2012, surfcast23 wrote: > > Wouldn't > > X= np.ones((1, 45)) > Y= np.zeros((32, 1)) > > change the existing values of the elements to ones and zeros? > > I was just demonstrating what np.broadcast_arrays() does. Take your x and y arrays and put them through this function and put the outputs into plot_wireframe(). Ignore the ones() and zeros(). Ben Root |