SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(11)
2
(24)
3
(24)
4
(31)
5
(30)
6
(27)
7
(25)
8
(8)
9
(2)
10
(12)
11
(16)
12
(33)
13
(18)
14
(17)
15
(3)
16
(7)
17
(8)
18
(22)
19
(20)
20
(25)
21
(10)
22
(17)
23
(18)
24
(23)
25
(15)
26
(19)
27
(6)
28
(7)
29
(6)
30
(1)
31
(12)





Showing 18 results of 18

From: marc d. <mde...@ya...> - 2009年08月23日 19:00:47
I just realized that by clicking once on the pan button, the cursor goes into pan, and clicking again, it goes back to the arrow. Same for some of the other buttons. I realized this by looking at the code. I would recommend that the documentation at the link shown below say something about this.
http://matplotlib.sourceforge.net/users/navigation_toolbar.html
Marc Desmarais
Long Beach, CA, 90814
 
From: marc d. <mde...@ya...> - 2009年08月23日 18:43:35
To create a cursor that only pans horizontally, I'm thinking of writing a special version of drag_pan in backend_bases.py It would call drag_pan in axes.py with the key argument set to 'x'
Any advice, suggestions?
backend_bases.py :
def my_drag_pan(self, event):
  'the drag callback in pan/zoom mode'
  for a, ind in self._xypress:
    a.drag_pan(self._button_pressed, 'x', event.x, event.y)
  self.dynamic_update()
  
#
# In axes, up/down motion is prevented when the 'x' key is down
#
axes.py
def drag_pan(self, button, key, x, y):
  ...
  elif key=='x':
        dy = 0
  ...
Marc Desmarais
Long Beach, CA, 90814
--- On Wed, 8/12/09, Eric Firing <ef...@ha...> wrote:
From: Eric Firing <ef...@ha...>
Subject: Re: [Matplotlib-users] pylab
To: "marc desmarais" <mde...@ya...>
Cc: "matplotlib-users" <mat...@li...>
Date: Wednesday, August 12, 2009, 9:59 AM
marc desmarais wrote:
> I found a typo at "http://matplotlib.sourceforge.net/users/navigation_toolbar.html"
> 
> "If you press ‘x’ or ‘y’ while panning the motion will be contrained to the x or y axis, respectively."
> 
Thank you. Now it is fixed.
> BTW, do you know how to constrain the panning function to left/right programmatically? I'm try to make a logic analyzer.
I don't know offhand, but I don't think that capability is in place. I find holding down a key while panning to be a bit awkward, so I am also interested in alternatives.
> 
> Finally, is this the best place to post my questions? (I suspect not...)
Yes, matplotlib-users is the right place. I assume you intended to "reply-to-all" on that last one, so intended it to go to the list. Apparently the settings on this list are unusual in that one must explicitly "reply-to-all"; it is not automatic that one's reply goes to the list.
Eric
> 
> --- On *Mon, 8/10/09, Eric Firing /<ef...@ha...>/* wrote:
> 
> 
>   From: Eric Firing <ef...@ha...>
>   Subject: Re: [Matplotlib-users] pylab
>   To: "marc desmarais" <mde...@ya...>
>   Cc: mat...@li...
>   Date: Monday, August 10, 2009, 7:22 PM
> 
>   marc desmarais wrote:
>   > Are there still two pylabs? Are the following two web pages
>   referring to the same pylab?
> 
>   Not exactly:
>   >
>   This one is a vision or proposal, open for discussion:
>   > http://www.scipy.org/PyLab
> 
>   This one is real:
>   > http://matplotlib.sourceforge.net/
>   >
> 
>   The pylab interface to the matplotlib plotting library has some of
>   the characteristics the author of the first link is talking about,
>   but the trend has been away from some aspects of that vision, not
>   towards it.
> 
>   For more about the real pylab, see
>   http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
> 
> 
>   > I'm a bit confused (trying to get the Scipy, Numpy, Pylab,
>   Matplolib story straight, before I plunge in)
> 
>   Numpy is the common core, providing N-dimensional arrays and math;
>   matplotlib is a plotting library, using numpy; scipy is a collection
>   of math/science functionality, also using numpy.
> 
>   But don't forget ipython, which provides a nice interactive shell:
>   http://ipython.scipy.org/moin/
> 
>   Eric
> 
>   >
>   > Marc Desmarais
>   > Long Beach, CA, 90814
> 
> 
 
From: John H. <jd...@gm...> - 2009年08月23日 18:28:42
On Sun, Aug 23, 2009 at 1:24 PM, Eric Firing<ef...@ha...> wrote:
> Dr. Phillip M. Feldman wrote:
>> I've been trying to understand how colormaps work. I've been through the
>> Matplotlib User's Guide (Release 0.98.6svn, dated June 14, 2009), but the
>> section on colormaps has not yet been written. If anyone can point me to
>
> This is my fault; I need to write that.
>
>> documentation or provide an explanation, I'd be grateful.
>
> This may help:
> http://matplotlib.sourceforge.net/api/colors_api.html
> http://matplotlib.sourceforge.net/api/cm_api.html
>
> and this:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html
>
> Beware: the posted docs are current, so may include functions that are
> not in the version of mpl you have installed.
>
> If you search for "cmap" using the search box in the doc webpage
> sidebar, you will get many more examples of the use of colormaps.
> Browsing these examples may be the quickest way of getting the basic
> ideas of how cmaps (and their partners, norms) are used.
>
> Looking at the source code is also helpful.
This example may be instructive: it takes a list of colors and creates
a colormap that interpolates smoothly between them from normalized
0..1.
But yes, a tutorial on the sphinx site would be great (at the sprint
yesterday one of the students wrote a nice image tut but I haven't
gotten it from him yet for upload)
 @staticmethod
 def from_list(name, colors, N=256):
 """
 Make a linear segmented colormap with *name* from a sequence
 of *colors* which evenly transitions from colors[0] at val=1
 to colors[-1] at val=1. N is the number of rgb quantization
 levels.
 """
 ncolors = len(colors)
 vals = np.linspace(0., 1., ncolors)
 cdict = dict(red=[], green=[], blue=[])
 for val, color in zip(vals, colors):
 r,g,b = colorConverter.to_rgb(color)
 cdict['red'].append((val, r, r))
 cdict['green'].append((val, g, g))
 cdict['blue'].append((val, b, b))
 return LinearSegmentedColormap(name, cdict, N)
From: Eric F. <ef...@ha...> - 2009年08月23日 18:24:22
Dr. Phillip M. Feldman wrote:
> I've been trying to understand how colormaps work. I've been through the
> Matplotlib User's Guide (Release 0.98.6svn, dated June 14, 2009), but the
> section on colormaps has not yet been written. If anyone can point me to
This is my fault; I need to write that.
> documentation or provide an explanation, I'd be grateful.
This may help:
http://matplotlib.sourceforge.net/api/colors_api.html
http://matplotlib.sourceforge.net/api/cm_api.html
and this:
http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html
Beware: the posted docs are current, so may include functions that are 
not in the version of mpl you have installed.
If you search for "cmap" using the search box in the doc webpage 
sidebar, you will get many more examples of the use of colormaps. 
Browsing these examples may be the quickest way of getting the basic 
ideas of how cmaps (and their partners, norms) are used.
Looking at the source code is also helpful.
Eric
From: Werner F. B. <wer...@fr...> - 2009年08月23日 17:52:47
Werner F. Bruhin wrote:
> I previously used version '0.90.1' and could do something along these lines.
>
> figure.add_axes
> ... etc
> canvas.Refresh()
>
> User makes a new selection and in the code I do:
>
> figure.clear()
> figure.add_axes
> ... etc
> canvas.Refresh()
>
> With 0.99 and wxAgg on Windows Vista with wxPython 2.8.10.1 Unicode and 
> Python 2.5.4 this does not work.
>
> The "old" figure remains and the new one is only shown when I resize the 
> frame which contains a wx.Splitter with the right window containing the 
> mpl.figure on a panel.
>
> If I add canvas.draw() then most is shown, except some mpl.text elements 
> (e.g. figure.title) - which again are shown if I resize.
>
> Appreciate any hint on how to solve this.
> 
I had to add the canvas.Draw() call, but I had that to early in my code, 
i.e. the title was only added to the figure after I had called Draw() - 
0.90 was forgiven me this stupid mistake.
Sorry for the noise.
Werner
From: Werner F. B. <wer...@fr...> - 2009年08月23日 16:45:50
I previously used version '0.90.1' and could do something along these lines.
figure.add_axes
... etc
canvas.Refresh()
User makes a new selection and in the code I do:
figure.clear()
figure.add_axes
... etc
canvas.Refresh()
With 0.99 and wxAgg on Windows Vista with wxPython 2.8.10.1 Unicode and 
Python 2.5.4 this does not work.
The "old" figure remains and the new one is only shown when I resize the 
frame which contains a wx.Splitter with the right window containing the 
mpl.figure on a panel.
If I add canvas.draw() then most is shown, except some mpl.text elements 
(e.g. figure.title) - which again are shown if I resize.
Appreciate any hint on how to solve this.
Werner
From: Ala Al-S. <sha...@ym...> - 2009年08月23日 15:29:21
Hello everyone,
I was playing around with matplotlib, created a plot that allows users to add nodes (axis is set off as it's going to be used for graph data structuer purposes, hence don't want the y-x axis, is there another way to hide them as well?).
Basically the program below allows person press the 'n' button, and then can click on any point on the plot and a small circular marker will appear.
I have two questions:
1) You will notice that during the first 2 marker inputs, the plot rescales it self. I don't really know why that's happening, any idea?
2) Is it possible to disallow users of creating to marker points ontop of each other, so that no markers will overlap (even if the edges)?
Thank you.
#### Code
from pylab import *
from matplotlib.widgets import *
fig = plt.figure()
ax = fig.add_subplot(111)
fig.set_facecolor('w')
ax.set_axis_off()
ax.set_title('Test 1')
cid = None
def onClick(event):
"""docstring for onClick"""
ax.plot([event.xdata], [event.ydata], 'bo', picker=5, markersize=15)
draw()
fig.canvas.mpl_disconnect(cid)
def onPick(event):
"""docstring for onPick"""
artist = event.artist
artist.set_color('r')
draw()
def add_node(event):
"""docstring for press"""
if event.key=="n":
global cid
fig.canvas.mpl_disconnect(cid)
cid = fig.canvas.mpl_connect('button_press_event',onClick)
fig.canvas.mpl_connect('key_press_event', add_node)
fig.canvas.mpl_connect('pick_event',onPick)
plt.show()
 
From: Dr. P. M. F. <pfe...@ve...> - 2009年08月23日 15:17:54
I've been trying to understand how colormaps work. I've been through the
Matplotlib User's Guide (Release 0.98.6svn, dated June 14, 2009), but the
section on colormaps has not yet been written. If anyone can point me to
documentation or provide an explanation, I'd be grateful.
-- 
View this message in context: http://www.nabble.com/how-do-colormaps-work--tp25104198p25104198.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sebastian B. <web...@th...> - 2009年08月23日 15:08:20
Attachments: signature.asc
Dr. Phillip M. Feldman wrote:
> Having to hit Enter is not a major problem, but I'm still not getting
> anything displayed.
i guess that might be because the "show" command before the loop blocks
the program.
you can omit the line with "show" or start ipython with
ipython -pylab
both versions work here.
good luck,
sebastian.
From: Dr. P. M. F. <pfe...@ve...> - 2009年08月23日 14:57:40
Having to hit Enter is not a major problem, but I'm still not getting
anything displayed.
I noticed that you used pyplot.draw() instead of pyplot.show(). I've
checked the available documentation, but haven't been able to understand the
difference between these.
I should have mentioned that I'm running this script from the IPython
prompt.
Thanks!
-- 
View this message in context: http://www.nabble.com/how-to-generate-one-plot-per-key-press--tp25100658p25104051.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi JJ,
I'm not sure I understand how to properly set the axe_locator. Below
is my snippet of code that I use to create my contourf plot and then
create the colorbar. I'm unsure how I would modify it to do as you
suggested. Any help would be appreciated.
 plot = ax.contourf(xc, yc, data, cmap=cmap, levels=clevels)
 cax = plt.axes([0.85, 0.125, 0.035, 0.325])
 cbar = fig.colorbar(plot, format='%.1f', cax=cax)
I should also point out that the reason I'm not using the axes_grid
toolkit is because I'm constrained to develop based on the current
Enthought release.
Patrick
---
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com
On Sat, Aug 22, 2009 at 10:37 PM, Jae-Joon Lee<lee...@gm...> wrote:
> What you need is to adjust the axes position of the colorbar at the
> drawing time (because the axes position of the contour plot is
> adjusted only during the drawing time).
> You may do this by properly setting the axe_locator property of the axes.
>
> If you're using mpl 0.99, axes_grid toolkit may be helpful.
> I just posted a simple example with the screenshot in the link below.
>
> http://abitofpythonabitofastronomy.blogspot.com/2009/08/creating-color-bar-using-inset-axes.html
>
> Regards,
>
> -JJ
>
>
>
> On Sat, Aug 22, 2009 at 9:51 PM, Patrick Marsh<pat...@gm...> wrote:
>> Greeting MPL world,
>>
>> I have a contourf plot where the aspect ratio is 1. I need to add a
>> colorbar to the plot in a manner that keeps the colorbar in the same
>> place relative to the contourf plot (good.png), even if the parent
>> window is resized. I can do this with text, but haven't been able to
>> figure out how to do it with a colorbar. To the best of my knowledge,
>> there are two ways forward.
>>
>> 1.) I can create an entirely new axis instance (cax) but will need to
>> find a way to define the axes in a relative way to the original ax
>> instance. As it stands now, I can only define axes in terms of the
>> total figure size. As a result, the figure looks like it does in
>> bad.png
>>
>>
>> 2.) I can use the original ax instance, but need to find a way to
>> have more control over the colorbar placement. For example, it needs
>> to "sit" on the x-axis and not be centered in the middle of the yaxis.
>> Using shrink and aspect, I can get the plot size to be correct,
>> however it's position is centered on the yaxis as in bad2.png
>>
>> Is there a way to accomplish what I'm needing to do and I'm just missing it?
>>
>> Thanks in advance,
>> Patrick
>> ---
>> Patrick MarshC
>> Graduate Research Assistant
>> School of Meteorology
>> University of OklahomaC
>> http://www.patricktmarsh.com
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: German O. <ger...@gm...> - 2009年08月23日 09:16:48
Good morning
I'm working in a project in QT4 and I need to create a 3D graph embedded in
a Widget form. Is it possible to do it? and where I could get an example?
Thanks
German
From: Paul I. <piv...@gm...> - 2009年08月23日 08:31:47
appologies - sys.stdin.read(1) blocks until you give it a new line
(<Enter>) that' s probably what you were having problems with.
 
Paul Ivanov, on 2009年08月23日 01:14, wrote:
> Try something like this:
> 
> 
> from os import sys
> from matplotlib import *
> from numpy.random import rand
> 
> fig= pyplot.figure(figsize=(8,8), dpi=120)
> pyplot.show()
> while True:
> z= rand(20,20)
> pyplot.imshow(z)
> pyplot.draw()
> 
> chr= sys.stdin.read(1)
> if chr=='q': 
> break
> 
> pyplot.close('all')
> 
> 
> cheers,
> Paul
> 
> Dr. Phillip M. Feldman, on 2009年08月22日 23:19, wrote:
> > 
> > The following trivial program is supposed to generate one plot per key press
> > until the user presses 'q'. Instead, nothing is displayed until the user
> > presses 'q'. Any suggestions will be appreciated.
> > 
> > from os import sys
> > from matplotlib import *
> > from numpy.random import rand
> > 
> > while True:
> > 
> > z= rand(20,20)
> > fig= pyplot.figure(figsize=(8,8), dpi=120)
> > pyplot.imshow(z)
> > pyplot.show()
> > 
> > chr= sys.stdin.read(1)
> > if chr=='q': sys.exit(0)
> > -- 
> > View this message in context: http://www.nabble.com/how-to-generate-one-plot-per-key-press--tp25100658p25100658.html
> > Sent from the matplotlib - users mailing list archive at Nabble.com.
> > 
> > 
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> > trial. Simplify your report design, integration and deployment - and focus on 
> > what you do best, core application coding. Discover what's new with 
> > Crystal Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul I. <piv...@gm...> - 2009年08月23日 08:14:45
Try something like this:
from os import sys
from matplotlib import *
from numpy.random import rand
fig= pyplot.figure(figsize=(8,8), dpi=120)
pyplot.show()
while True:
 z= rand(20,20)
 pyplot.imshow(z)
 pyplot.draw()
 chr= sys.stdin.read(1)
 if chr=='q': 
 break
pyplot.close('all')
cheers,
 Paul
Dr. Phillip M. Feldman, on 2009年08月22日 23:19, wrote:
> 
> The following trivial program is supposed to generate one plot per key press
> until the user presses 'q'. Instead, nothing is displayed until the user
> presses 'q'. Any suggestions will be appreciated.
> 
> from os import sys
> from matplotlib import *
> from numpy.random import rand
> 
> while True:
> 
> z= rand(20,20)
> fig= pyplot.figure(figsize=(8,8), dpi=120)
> pyplot.imshow(z)
> pyplot.show()
> 
> chr= sys.stdin.read(1)
> if chr=='q': sys.exit(0)
> -- 
> View this message in context: http://www.nabble.com/how-to-generate-one-plot-per-key-press--tp25100658p25100658.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Dr. P. M. F. <pfe...@ve...> - 2009年08月23日 06:19:29
The following trivial program is supposed to generate one plot per key press
until the user presses 'q'. Instead, nothing is displayed until the user
presses 'q'. Any suggestions will be appreciated.
from os import sys
from matplotlib import *
from numpy.random import rand
while True:
 z= rand(20,20)
 fig= pyplot.figure(figsize=(8,8), dpi=120)
 pyplot.imshow(z)
 pyplot.show()
 chr= sys.stdin.read(1)
 if chr=='q': sys.exit(0)
-- 
View this message in context: http://www.nabble.com/how-to-generate-one-plot-per-key-press--tp25100658p25100658.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年08月23日 04:12:55
On Thu, Aug 20, 2009 at 2:01 AM, Sameer Regmi<re...@gm...> wrote:
> We tried the method 1 but the result was a garbled mesh
Please describe what you did and why the result is wrong.
The method 1 with quadratic bezier curve should be most
straight-forward and easy thing to do. Calculating the control points
is also straight forward. While you may simply use
matplotlib.bezier.get_intersection, you'd better come up with some
optimized version since you need to calculate this for lots of
positions.
It is not clear how you're drawing path currently, but Line2D class is
not suitable for bezier lines. You may use PathPatch class. Or you can
create your own artist class (maybe this is what you meant by
"implemented"). A simple version of bezier artist can be found in
mpl_toolkits.axes_grid.axeslines.BezierPath (included in mpl 0.99).
If you haven't, please take a look at the tutorial below.
http://matplotlib.sourceforge.net/users/path_tutorial.html
-JJ
What you need is to adjust the axes position of the colorbar at the
drawing time (because the axes position of the contour plot is
adjusted only during the drawing time).
You may do this by properly setting the axe_locator property of the axes.
If you're using mpl 0.99, axes_grid toolkit may be helpful.
I just posted a simple example with the screenshot in the link below.
http://abitofpythonabitofastronomy.blogspot.com/2009/08/creating-color-bar-using-inset-axes.html
Regards,
-JJ
On Sat, Aug 22, 2009 at 9:51 PM, Patrick Marsh<pat...@gm...> wrote:
> Greeting MPL world,
>
> I have a contourf plot where the aspect ratio is 1. I need to add a
> colorbar to the plot in a manner that keeps the colorbar in the same
> place relative to the contourf plot (good.png), even if the parent
> window is resized. I can do this with text, but haven't been able to
> figure out how to do it with a colorbar. To the best of my knowledge,
> there are two ways forward.
>
> 1.) I can create an entirely new axis instance (cax) but will need to
> find a way to define the axes in a relative way to the original ax
> instance. As it stands now, I can only define axes in terms of the
> total figure size. As a result, the figure looks like it does in
> bad.png
>
>
> 2.) I can use the original ax instance, but need to find a way to
> have more control over the colorbar placement. For example, it needs
> to "sit" on the x-axis and not be centered in the middle of the yaxis.
> Using shrink and aspect, I can get the plot size to be correct,
> however it's position is centered on the yaxis as in bad2.png
>
> Is there a way to accomplish what I'm needing to do and I'm just missing it?
>
> Thanks in advance,
> Patrick
> ---
> Patrick MarshC
> Graduate Research Assistant
> School of Meteorology
> University of OklahomaC
> http://www.patricktmarsh.com
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Patrick M. <pat...@gm...> - 2009年08月23日 01:51:40
Attachments: bad.png bad2.png good.png
Greeting MPL world,
I have a contourf plot where the aspect ratio is 1. I need to add a
colorbar to the plot in a manner that keeps the colorbar in the same
place relative to the contourf plot (good.png), even if the parent
window is resized. I can do this with text, but haven't been able to
figure out how to do it with a colorbar. To the best of my knowledge,
there are two ways forward.
1.) I can create an entirely new axis instance (cax) but will need to
find a way to define the axes in a relative way to the original ax
instance. As it stands now, I can only define axes in terms of the
total figure size. As a result, the figure looks like it does in
bad.png
2.) I can use the original ax instance, but need to find a way to
have more control over the colorbar placement. For example, it needs
to "sit" on the x-axis and not be centered in the middle of the yaxis.
 Using shrink and aspect, I can get the plot size to be correct,
however it's position is centered on the yaxis as in bad2.png
Is there a way to accomplish what I'm needing to do and I'm just missing it?
Thanks in advance,
Patrick
---
Patrick MarshC
Graduate Research Assistant
School of Meteorology
University of OklahomaC
http://www.patricktmarsh.com

Showing 18 results of 18

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /