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





Showing 22 results of 22

From: sgee <jaa...@gm...> - 2011年01月18日 23:33:14
I'm a CFD student and I wish to learn to make high-quality plots from my
calculations using matplotlib. However, I'm a complete novice in using
matplotlib and python and I didn't find any earlier posts so here goes. 
I have data form Ansys Fluent in the following form
continuity x-velocity y-velocity energy 	 
k epsilon 		
1 0.00011115784 1.5359586e-07 1.0506172e-07 0.0032920227 
0.40809903 	
1 0.16584706 0.0047719572 2.7355736e-07 
0.026478255 0.19814095
0.5674 0.044237841 0.0026294924 2.8202695e-07 0.030139321 
0.13935529	
The first line is for the first iteration, the second line for the second
iteration etc. Basically, I would like to have plot this data and have a
picture like http://openfoamwiki.net/images/f/ff/Pump_residuals.png this 
Any help would be much appreciated. 
BR Jack
-- 
View this message in context: http://old.nabble.com/Beginner-and-plotting-CFD-data-from-file-tp30705461p30705461.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Alex L. <ale...@gm...> - 2011年01月18日 23:33:08
Hi,
While moving from Matlab to Numpy/Scipy/Matplotlib I need sometimes to work with Matlab figures. It would be nice if we could load Matlab figures in Python, extract the data and some basic parameters of how it was looking in Matlab and create its "clone" in matplotlib. At present the Matlab figures are MAT files and in the near future it will be HDF5, both formats are loadable. However, I have not found any reference for such attempts to load and parse the FIG files. As a beginner I find it difficult to write a large piece of code. However, if there are other interested users that can cooperate on such, I'd gladly contribute some hours for this task. Meanwhile, to show the proof-of-concept attempt is attached below. All your useful comments and suggestions are very welcome. 
Thank you,
Alex 
#------------ loadfig.py ---------------------- #
""" Loadfig loads simple Matlab figures as MAT files and plots the lines using matplotlib
"""
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
def lowest_order(d):
	""" 
	lowestsc_order(hgstruct) finds the handle of axes (i.e. children of figure handles, etc.)
	
	"""
	while not 'graph2d.lineseries' in d['type']:
		d = d['children'][0][0]
	return d
	
def get_data(d):
	""" 
	get_data(hgstruct) extracts XData, YData, Color and Marker of each line in the 
	given axis
	
	Parameters
	----------
	hgstruct : structure 
		obtained from lowest_order(loadmat('matlab.fig'))
	
	"""
	xd,yd,dispname,marker,colors = [],[],[],[],[]
	for i in d:
		if i['type'] == 'graph2d.lineseries':
			xd.append(i['properties'][0][0]['XData'][0][0])
			yd.append(i['properties'][0][0]['YData'][0][0])
			dispname.append(i['properties'][0][0]['DisplayName'][0][0])
			marker.append(i['properties'][0][0]['Marker'][0][0])
			colors.append(i['properties'][0][0]['Color'][0][0])
			
	return np.asarray(xd),np.asarray(yd),dispname,np.asarray(marker).astype('S1'),colors
def plot_data(xd,yd,dispname=None,marker=None,colors=None):
	"""
	plot_data(xd,yd,dispname=None,marker=None,colors=None)
	
	plots the data sets extracted by get_data(lowest_order(loadmat('matlab.fig')))	
	
	Parameters
	----------
		xd,yd : array_like
			data arrays 
		dispname : array of strings 
			to be used in legend, optional
		marker : array of characters
			markers, e.g. ['o','x'], optional
		colors : array of color sets 
			in RGB, e.g. [[0,0,1],[1,0,0]], optional
			
		
	"""
	for i,n in enumerate(xd):
		plt.plot(xd[i].T,yd[i].T,color=tuple(colors[i]),marker=marker[i],linewidth=0)
		
	plt.legend(dispname)
	plt.show()
def main(filename):
	"""
	main(filename) 
	
	loads the filename (with the extension .fig) which is Matlab figure. At the moment only
	simple 2D lines are supported. 
	
	Examples
	-------
	>>> loadfig('matlab.fig') # is equivalent to:
	
	>>> d = loadmat(filename)
	>>> d = d['hgS_070000']
	>>> xd,yd,dispname,marker,colors = get_data(lowest_order(d))
	>>> plot_data(xd,yd,dispname,marker,colors)
	
	"""
	d = loadmat(filename)
	# ver 7.2 or lower:
	d = d['hgS_070000']
	xd,yd,dispname,marker,colors = get_data(lowest_order(d))
	plot_data(xd,yd,dispname,marker,colors)
if __name__ == "__main__":
 import sys
 import os
 try:
 	filename = sys.argv[1]
 	main(filename)
 except:
 	print("Wrong file")
# ----------------------------- EOF loadfig.py --------------------------- # 
Alex Liberzon
Turbulence Structure Laboratory [http://www.eng.tau.ac.il/efdl]
School of Mechanical Engineering
Tel Aviv University
Ramat Aviv 69978
Israel
Tel: +972-3-640-8928
Lab: +972-3-640-6860 (telefax)
E-mail: al...@en...
Clément PORNET, on 2011年01月18日 18:39, wrote:
> 
> Hi everyone,After having compiling and installing Matplotlib 1.0.1 with Python 2.5.5 on a Unix platform sunos5, I ran into the following problem, when trying to import pyplot or pylab.Here is the ouput when using ipython:
> 
> ImportError: ld.so.1: ipython: fatal: relocation error: file
> /home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/_path.so:
> symbol _ZNSs4_Rep20_S_empty_rep_storageE: referenced symbol not
> found
Clément,
this is likely due to a misbuilt matplotlib - have you update
numpy since you last built matplotlib?
Can you try deleting ../site-packages/matplotlib, and the build/
directory for your sources of mpl1.0.1 and reinstall? Please
report back either way so we get a handle on this.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Paul I. <piv...@gm...> - 2011年01月18日 21:41:33
From: Paul Ivanov <piv...@gm...>
To: Larry Evans <cpp...@su...>
Cc: 
Bcc: 
Subject: Re: [Matplotlib-users] what does numRows, numCols in subplot docs
 mean?
Reply-To: 
In-Reply-To: <4D3...@su...>
X-PGP-Key: http://pirsquared.org/PaulIvanov0F3E28F7.asc
Larry Evans, on 2011年01月16日 06:11, wrote:
> subplot(numRows, numCols, plotNum)
> 
> 
> New subplots that overlap old will delete the old axes.
> 
> However, that doc does not explain what a row or column is or what
> overlap means.
> 
> Is there some way the figure is partitioned into rows and columns and the
> subplots appear in these rows and columns. If so, then how is this
> partition
> done? Does subplot(1,2,1) appear to the left and at same level as
> subplot(1,2,2)?
> What if there's subplot(1,2,1) and subplot(2,1,1). Do they overlap and
> if so, why?
> IOW, what's the definition of overlap?
Hi Larry,
Overlap means identical parameters for subplot:
 In [1]: ax1 = plt.subplot(1,2,1)
 
 In [2]: ax2 = plt.subplot(1,2,2)
 
 In [3]: ax3 = plt.subplot(1,2,1) # overlap, will delete ax1
 
 In [4]: fig = plt.gcf()
 
 In [5]: fig.axes
 Out[5]: 
 [<matplotlib.axes.AxesSubplot object at 0xa1b582c>,
 <matplotlib.axes.AxesSubplot object at 0xa33968c>]
 
 In [6]: ax1
 Out[6]: <matplotlib.axes.AxesSubplot object at 0xa1b582c>
 
 In [7]: ax2
 Out[7]: <matplotlib.axes.AxesSubplot object at 0xa33968c>
 
 In [8]: ax3
 Out[8]: <matplotlib.axes.AxesSubplot object at 0xa1b582c>
 
 In [9]: ax4 = plt.subplot(2,2,1) # also overlaps with ax3
 
 In [10]: ax5 = plt.subplot(2,2,4) # overlaps with ax2
 
 In [12]: fig.axes
 Out[12]: 
 [<matplotlib.axes.AxesSubplot object at 0xa49882c>,
 <matplotlib.axes.AxesSubplot object at 0xa5118ac>]
The last parameter ("plotNum") for subplot determines which row
and column you want based on something like the formula:
 row = plotNum // numCols
 column = plotNum % numCols
Hope that helps,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
In article <26F...@sy...>,
 Leslie Burnett 
 <les...@sy...> wrote:
> Pathways leading to the error message:
> 
> I obtained Matplotlib from the matplotlib home page download link to 
> sourceforge
> 
> a) mpkg/dmg installation 1.0.1-r0 fails with message "can't be installed on 
> this disk. matplotlib requires System Python 2.6 to install"
The mpkg/dmg installer requires python from python.org, not Apple's 
built-in python (despite the incorrect error message). The README that 
is displayed by the installer does explain this, but it is easy to miss.
Note that the incorrect error message is a known bug in the software 
that creates mpkg installers.
I suggest you use the binary installer because building from source is 
rather a lot of work, due to the need to install dependencies.
-- Russell
From: Benjamin R. <ben...@ou...> - 2011年01月18日 18:59:54
On Tue, Jan 18, 2011 at 10:56 AM, Jeff Peery <jef...@se...>wrote:
> Hello,
>
> I just upgraded my computer to windows 7. I have everything (python,
> wxpython, matplotlib, numpy) running now, but there is an annoying problem
> that when I double click on one of my scripts (simple pylab script) it runs
> creates a figure and plot then immediately closes... so I don’t get to look at
> my plot. I have WXagg configured as the backend because I use matplotlib in
> several wxpython applications. But right now I am just using pylabin a
> single script to make simple plots. If I run the script from IDLE it works
> ok until I try to close the figure, then it locks up until I kill the IDLE.
> If I run in pythonwin I get the same problem as the IDLE.
>
>
>
> I’d like to just click on the script icon to run it, and when I run the
> script from the IDLE I’d like the figure to close when I kill it. How might
> I correct these issues?
>
>
>
> Thanks,
>
> Jeff
>
>
This probably depends on on you are coding the plot generation scripts. Can
you attach a script for us to see?
Ben Root
Hi everyone,After having compiling and installing Matplotlib 1.0.1 with Python 2.5.5 on a Unix platform sunos5, I ran into the following problem, when trying to import pyplot or pylab.Here is the ouput when using ipython:
co200009@mx61$ ipython
WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library
Python 2.5.5 (r255:77872, Jan 14 2011, 11:05:26) 
Type "copyright", "credits" or "license" for more information.
IPython 0.10.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
[~/PYTHON-2.5/bin]
|1>import numpy
[~/PYTHON-2.5/bin]
|2>import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/co200009/PYTHON-2.5/bin/<ipython console> in <module>()
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/pyplot.py in <module>()
 21 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike
 22 from matplotlib import docstring
---> 23 from matplotlib.figure import Figure, figaspect
 24 from matplotlib.backend_bases import FigureCanvasBase
 25 from matplotlib.image import imread as _imread
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/figure.py in <module>()
 14 import numpy as np
 15 
---> 16 import artist
 17 from artist import Artist, allow_rasterization
 18 from axes import Axes, SubplotBase, subplot_class_factory
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/artist.py in <module>()
 4 import matplotlib.cbook as cbook
 5 from matplotlib import docstring, rcParams
----> 6 from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
 7 from path import Path
 8 
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/transforms.py in <module>()
 32 import numpy as np
 33 from numpy import ma
---> 34 from matplotlib._path import affine_transform
 35 from numpy.linalg import inv
 36 
ImportError: ld.so.1: ipython: fatal: relocation error: file /home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/_
path.so: symbol _ZNSs4_Rep20_S_empty_rep_storageE: referenced symbol not found
[~/PYTHON-2.5/bin]
|3>import pylab
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/co200009/PYTHON-2.5/bin/<ipython console> in <module>()
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/pylab.py in <module>()
----> 1 from matplotlib.pylab import *
 2 import matplotlib.pylab
 3 __doc__ = matplotlib.pylab.__doc__
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/pylab.py in <module>()
 218 silent_list, iterable, dedent
 219 
--> 220 from matplotlib import mpl # pulls in most modules
 221 
 222 from matplotlib.dates import date2num, num2date,\
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/mpl.py in <module>()
 2 from matplotlib import axis
 3 from matplotlib import axes
 4 from matplotlib import cbook
 5 from matplotlib import collections
 6 from matplotlib import colors
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/artist.py in <module>()
 4 import matplotlib.cbook as cbook
 5 from matplotlib import docstring, rcParams
----> 6 from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
 7 from path import Path
 8 
/home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/transforms.py in <module>()
 32 import numpy as np
 33 from numpy import ma
---> 34 from matplotlib._path import affine_transform
 35 from numpy.linalg import inv
 36 
ImportError: ld.so.1: ipython: fatal: relocation error: file /home/co200009/PYTHON-2.5/lib/python2.5/site-packages/matplotlib/_path.so: symbol _ZNSs4_Rep20_S_empty_rep_storageE: referenced symbol not found
Could anyone help me to solve this problem?
Thanks a lot,Best Regards, Clément 		 	 		 
From: Eric F. <ef...@ha...> - 2011年01月18日 18:07:57
On 01/17/2011 10:24 PM, sprobst wrote:
>
> Hi all,
>
> I want to make a contout plot with a slider element. But I am not sure if it
> is possible at all and if it is possible how.
With contouring, you have to simply remake the ContourSet (that is, 
re-run contour) with any change to the data being contoured.
Eric
>
> The code is a mixture of two examples I found in the web. One part is the
> slider example of matplotlib
>
>
>
>> from pylab import *
>>
>> N = 50
>> x = linspace(.0, 1.0, N)
>> y = linspace(.0, 1.0, N)
>> X, Y = meshgrid(x, y)
>> Z = sin(X+16) - 2*cos(Y*5.2)
>> c = contourf(X, Y, Z,20)
>> colorbar()
>>
>> # Copied from the slider example ... not sure about the syntax
>> axfreq = axes([0.25, 0.1, 0.65, 0.03])
>> sfreq = Slider(axfreq, 'Amp', 0.1, 10.0, valinit=1)
>> def update(val):
>> 	global sfreq
>> 	freq = sfreq.val
>> 	Z = sin(freq*X+16) - 2*cos(Y*5.2)
>> 	c.set_data(Z) # Is something like that possible
>> 	draw()
>> sfreq.on_changed(update)
>> show()
>>
>
> I tried different stuff, but could not solve the problem. Perhaps anybody
> has an idea to help me.
>
> Thank you!
>
> Best regards
> Stefan
From: todd r. <tod...@gm...> - 2011年01月18日 17:55:21
Maybe, I am not that familiar with X11 programming. Do you happen to
know which source files I should change?
-Todd
On Tue, Jan 18, 2011 at 8:39 AM, Michael Droettboom <md...@st...> wrote:
> You're right -- matplotlib doesn't set any of these attributes. Fixing
> this problem would involve adding a few lines of code to set them in
> each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably
> handles them differently). Is this something you'd be interested in
> providing a patch for?
>
> Mike
>
> On 01/15/2011 03:06 PM, todd rme wrote:
>> On X11 systems, windows generally provide information about themselves
>> to the system. These include things like the window title, window
>> class, window role, and window type. These allow window managers to
>> properly handle the windows, and in some window managers (like KDE's
>> kwin), lets you set rules for windows of certain types.
>>
>> As best as I can tell, by default matplotlib does not provide most of
>> this information. It provides the window title and the window type,
>> but it doesn't seem to provide the window class or the window role.
>> These two properties, however, are exactly the properties someone
>> would want to use when trying to set up rules for particular windows.
>> This makes it impossible to set window-specific rules for the plots.
>>
>> Is there something in the matplotlib configuration that would let
>> someone set these properties, and if not is there any way matplotlib
>> could set them itself?
>>
>> I'm sorry if this is a common question.
>>
>> -Todd
>>
>> ------------------------------------------------------------------------------
>> Protect Your Site and Customers from Malware Attacks
>> Learn about various malware tactics and how to avoid them. Understand
>> malware threats, the impact they can have on your business, and how you
>> can protect your company and customers by using code signing.
>> http://p.sf.net/sfu/oracle-sfdevnl
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jeff P. <jef...@se...> - 2011年01月18日 17:17:39
Hello,
I just upgraded my computer to windows 7. I have everything (python, wxpython, matplotlib, numpy) running now, but there is an annoying problem that when I double click on one of my scripts (simple pylab script) it runs creates a figure and plot then immediately closes... so I don't get to look at my plot. I have WXagg configured as the backend because I use matplotlib in several wxpython applications. But right now I am just using pylabin a single script to make simple plots. If I run the script from IDLE it works ok until I try to close the figure, then it locks up until I kill the IDLE. If I run in pythonwin I get the same problem as the IDLE.
I'd like to just click on the script icon to run it, and when I run the script from the IDLE I'd like the figure to close when I kill it. How might I correct these issues?
Thanks,
Jeff
From: <g.p...@ru...> - 2011年01月18日 16:10:01
> 
> Instead of tick_right() try:
> 
> AX2.yaxis.set_ticks_position('right')
> 
Unfortunately this doesn't solve the problem (if it matters, I run matplotlib version 0.99 from Fedora 13).
From: <sam...@ru...> - 2011年01月18日 15:33:19
> 
> Instead of tick_right() try:
> 
> AX2.yaxis.set_ticks_position('right')
> 
Unfortunately this doesn't solve the problem (if it matters, I run matplotlib version 0.99 from Fedora 13).
From: Ryan M. <rm...@gm...> - 2011年01月18日 14:55:39
On Tue, Jan 18, 2011 at 2:52 AM, <g.p...@ru...> wrote:
> Hi,
>
> I have a problem with plotting two different quantities on the same plot (overlaying two different axes).
> I plot two different quantities, with different scales, on two overlapping axes. So, I want the quantity 1 to refer to the y axis on the left (with its ticks and labels), and quantity 2 to refer to the y axis on the right (with its ticks and labels). I choose on which side I want the ticks with ax.yaxis.tick_left(). Anyway, if I want then to change the label size of the right y axis, I can't do that. I included a sample plot.
>
> My code is something like this:
>
> F   = figure()
> #First quantity
> AX1 = F.add_axes(rect)
> AX1.plot(x1,y1)
> AX1.yaxis.tick_left() #with this I say quantity 1=left y axis
> AX1.set_yticks(range(2,14,2))
> AX1.set_yticklabels(range(2,14,2),size=20)
> #Second quantity (with different scale)
> AX2 = F.add_axes(rect,frameon=False)
> AX2.plot(x2,y2)
> AX2.yaxis.tick_right() #If I leave this line, I can't change the tick label size, if I remove it, I get ticks on both sides
> AX2.set_yticks(np.arange(16.8,18.8,0.4))
> AX2.set_yticklabels(np.arange(16.8,18.8,0.4),size=20,position=(1.08,0))
Instead of tick_right() try:
AX2.yaxis.set_ticks_position('right')
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Jeff W. <js...@fa...> - 2011年01月18日 14:22:12
On 1/18/11 6:43 AM, Nathanaël Schaeffer wrote:
> If it can help, here is a screenshot of the resulting figure of the 
> previous script :
> http://www.zimagez.com/zimage/basemapbug.php
> Interestingly, when hoovering the mouse over the figure the displayed 
> x values start at 0 on the beginning of the coastlines, not on the 
> drawn boudary maps, and ends at 4.83 at the other end.
>
> On Tue, Jan 18, 2011 at 2:29 PM, Nathanaël Schaeffer 
> <nat...@gm... <mailto:nat...@gm...>> 
> wrote:
>
> 2011年1月18日 Jeff Whitaker <js...@fa...
> <mailto:js...@fa...>>
>
> On 1/18/11 3:33 AM, Nathanaël Schaeffer wrote:
>
> Dear matplotlib developpers,
>
> I use matplotlib for several years and I'm very satisfied
> with the it.
> I started using the basemap package a few days ago, and I
> noticed something that looks like a bug :
>
> With the Mollweide projection (and others too), when
> specifying rsphere=1.0, the coastlines is not drawn in the
> left part of the plot. With rsphere=2.0 the hidden part is
> smaller, and with rsphere=10.0 it is not visible.
>
> I'm using matplotlib 1.0.0 and basemap 1.0
> To reproduce the bug :
>
> m = Basemap(projection='moll',lon_0=180,rsphere=1.0)
> m.drawcoastlines(linewidth=0.5, color='grey') # draw
> discrete coastlines
> m.drawmapboundary() # draw a line around the map region
> show()
>
> Nathanaël: Your test script works fine for me (no coastlines
> are missing). What version of the geos library did you link
> against?
>
>
> geos 3.2.2
>
> Concerning your previous message, sure r=1 is small, but I would
> have thought that it is a simple scaling, and with double
> precision floating point numbers, this should not be a problem. In
> physics, it is common to set unit radius for the sphere. Anyway,
> this is not a very important bug, as setting a larger value works
> well.
>
>
Nathanaël:
Can't reproduce it (I'm using geos 3.2.2 as well). Can you try 
updating from svn and see if the problem persists?
You'll get hammer that way too.
-Jeff
From: Michael D. <md...@st...> - 2011年01月18日 13:39:43
You're right -- matplotlib doesn't set any of these attributes. Fixing 
this problem would involve adding a few lines of code to set them in 
each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably 
handles them differently). Is this something you'd be interested in 
providing a patch for?
Mike
On 01/15/2011 03:06 PM, todd rme wrote:
> On X11 systems, windows generally provide information about themselves
> to the system. These include things like the window title, window
> class, window role, and window type. These allow window managers to
> properly handle the windows, and in some window managers (like KDE's
> kwin), lets you set rules for windows of certain types.
>
> As best as I can tell, by default matplotlib does not provide most of
> this information. It provides the window title and the window type,
> but it doesn't seem to provide the window class or the window role.
> These two properties, however, are exactly the properties someone
> would want to use when trying to set up rules for particular windows.
> This makes it impossible to set window-specific rules for the plots.
>
> Is there something in the matplotlib configuration that would let
> someone set these properties, and if not is there any way matplotlib
> could set them itself?
>
> I'm sorry if this is a common question.
>
> -Todd
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jeff W. <js...@fa...> - 2011年01月18日 13:00:06
On 1/18/11 3:33 AM, Nathanaël Schaeffer wrote:
> Dear matplotlib developpers,
>
> I use matplotlib for several years and I'm very satisfied with the it.
> I started using the basemap package a few days ago, and I noticed 
> something that looks like a bug :
>
> With the Mollweide projection (and others too), when specifying 
> rsphere=1.0, the coastlines is not drawn in the
> left part of the plot. With rsphere=2.0 the hidden part is smaller, 
> and with rsphere=10.0 it is not visible.
>
> I'm using matplotlib 1.0.0 and basemap 1.0
> To reproduce the bug :
>
> m = Basemap(projection='moll',lon_0=180,rsphere=1.0)
> m.drawcoastlines(linewidth=0.5, color='grey') # draw discrete 
> coastlines
> m.drawmapboundary() # draw a line around the map region
> show()
Nathanaël: Your test script works fine for me (no coastlines are 
missing). What version of the geos library did you link against?
-Jeff
From: Stefan M. <ste...@mn...> - 2011年01月18日 11:25:46
Hi Everyone, 
I would like to format the labels of a colorbar with mathtext. I have
tried a lot with all the cax.formatter.___ options but unfortunately I
was not able to get it working. 
I am plotting some Data with
 col = ax.pcolorfast( ... )
after this I create a colorbar with 
 cax = fig.colorbar(col)
Then I would like to change the formatter and the powerlimits with
 cax.formatter.format = '$%1.2f$'
 cax.formatter.set_powerlimits( (-4,4) )
but this does not work for me. 
Could you pleas help me to set the powerlimits and to format the labels
of a colorbar with mathtext. 
Regards,
Stefan 
From: <g.p...@ru...> - 2011年01月18日 09:13:21
Attachments: fig_wrong1.pdf
Hi,
I have a problem with plotting two different quantities on the same plot (overlaying two different axes).
I plot two different quantities, with different scales, on two overlapping axes. So, I want the quantity 1 to refer to the y axis on the left (with its ticks and labels), and quantity 2 to refer to the y axis on the right (with its ticks and labels). I choose on which side I want the ticks with ax.yaxis.tick_left(). Anyway, if I want then to change the label size of the right y axis, I can't do that. I included a sample plot.
My code is something like this:
F = figure()
#First quantity
AX1 = F.add_axes(rect)
AX1.plot(x1,y1)
AX1.yaxis.tick_left() #with this I say quantity 1=left y axis
AX1.set_yticks(range(2,14,2))
AX1.set_yticklabels(range(2,14,2),size=20)
#Second quantity (with different scale)
AX2 = F.add_axes(rect,frameon=False)
AX2.plot(x2,y2)
AX2.yaxis.tick_right() #If I leave this line, I can't change the tick label size, if I remove it, I get ticks on both sides
AX2.set_yticks(np.arange(16.8,18.8,0.4))
AX2.set_yticklabels(np.arange(16.8,18.8,0.4),size=20,position=(1.08,0))
Any ideas?
Thanks,
Andrea
From: sprobst <Ste...@gm...> - 2011年01月18日 08:24:26
Hi all,
I want to make a contout plot with a slider element. But I am not sure if it
is possible at all and if it is possible how.
The code is a mixture of two examples I found in the web. One part is the
slider example of matplotlib
> from pylab import *
> 
> N = 50
> x = linspace(.0, 1.0, N)
> y = linspace(.0, 1.0, N)
> X, Y = meshgrid(x, y)
> Z = sin(X+16) - 2*cos(Y*5.2)
> c = contourf(X, Y, Z,20)
> colorbar() 
> 
> # Copied from the slider example ... not sure about the syntax
> axfreq = axes([0.25, 0.1, 0.65, 0.03])
> sfreq = Slider(axfreq, 'Amp', 0.1, 10.0, valinit=1)
> def update(val):
> 	global sfreq
> 	freq = sfreq.val
> 	Z = sin(freq*X+16) - 2*cos(Y*5.2)
> 	c.set_data(Z) # Is something like that possible
> 	draw()
> sfreq.on_changed(update)
> show()
> 
I tried different stuff, but could not solve the problem. Perhaps anybody
has an idea to help me.
Thank you!
 Best regards 
 Stefan
-- 
View this message in context: http://old.nabble.com/Contour-Contourf-dynamically-with-slider-tp30698071p30698071.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Tim B. <tim...@ma...> - 2011年01月18日 07:11:18
Thanks, Paul! A bit of tweaking in my actual app but it now works beautifully!
On 18/01/2011, at 4:08 PM, Paul Ivanov wrote:
> Tim Burgess, on 2011年01月18日 13:32, wrote:
>> I'm generating images that I want to use as overlays in Google
>> Earth. Thus, I would like the masked portion of the numpy
>> arrays I am using to appear as transparent. However, I seem to
>> consistently get white instead of a transparent point.
>> 
>> To clarify the issue, I wrote this short piece of code. I am
>> setting both the figure background to transaprent and the
>> masked value to transparent but I get white.
>> 
>> I have pulled the current svn code and built matplotlib. I get
>> the same issue. 
>> 
>> from numpy import ma
>> import matplotlib.pyplot as plt
>> from pylab import colorbar, imshow, show, cm
>> 
>> 
>> def main():
>> a = ma.array([[1,2,3],[4,5,6]],mask=[[0,0,1],[0,0,0]])
>> fig = plt.figure()
>> fig.patch.set_alpha(0.0)
>> cmap = cm.jet
>> cmap.set_bad(alpha=0.0)
>> imshow(a, interpolation='nearest', cmap=cmap)
>> colorbar()
>> show()
> 
> Hi Tim,
> 
> sorry to hear of your troubles - add these two lines to get your
> desired effect:
> 
> ax = plt.gca()
> ax.patch.set_alpha(0.0)
> 
> The figure has a patch associated with it, but so does each axes 
> subplot, which is what you were seeing through the transparent
> portion of your masked array image.
> 
> best,
> -- 
> Paul Ivanov
> 314 address only used for lists, off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand 
> malware threats, the impact they can have on your business, and how you 
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul I. <piv...@gm...> - 2011年01月18日 06:08:29
Tim Burgess, on 2011年01月18日 13:32, wrote:
> I'm generating images that I want to use as overlays in Google
> Earth. Thus, I would like the masked portion of the numpy
> arrays I am using to appear as transparent. However, I seem to
> consistently get white instead of a transparent point.
> 
> To clarify the issue, I wrote this short piece of code. I am
> setting both the figure background to transaprent and the
> masked value to transparent but I get white.
> 
> I have pulled the current svn code and built matplotlib. I get
> the same issue. 
> 
> from numpy import ma
> import matplotlib.pyplot as plt
> from pylab import colorbar, imshow, show, cm
> 
> 
> def main():
> a = ma.array([[1,2,3],[4,5,6]],mask=[[0,0,1],[0,0,0]])
> fig = plt.figure()
> fig.patch.set_alpha(0.0)
> cmap = cm.jet
> cmap.set_bad(alpha=0.0)
> imshow(a, interpolation='nearest', cmap=cmap)
> colorbar()
> show()
Hi Tim,
sorry to hear of your troubles - add these two lines to get your
desired effect:
 ax = plt.gca()
 ax.patch.set_alpha(0.0)
The figure has a patch associated with it, but so does each axes 
subplot, which is what you were seeing through the transparent
portion of your masked array image.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Tim B. <tim...@ma...> - 2011年01月18日 03:29:17
I'm generating images that I want to use as overlays in Google Earth. Thus, I would like the masked portion of the numpy arrays I am using to appear as transparent.
However, I seem to consistently get white instead of a transparent point.
To clarify the issue, I wrote this short piece of code. I am setting both the figure background to transaprent and the masked value to transparent but I get white.
I have pulled the current svn code and built matplotlib. I get the same issue. 
from numpy import ma
import matplotlib.pyplot as plt
from pylab import colorbar, imshow, show, cm
def main():
 a = ma.array([[1,2,3],[4,5,6]],mask=[[0,0,1],[0,0,0]])
 fig = plt.figure()
 fig.patch.set_alpha(0.0)
 cmap = cm.jet
 cmap.set_bad(alpha=0.0)
 imshow(a, interpolation='nearest', cmap=cmap)
 colorbar()
 show()
Any thoughts?
Tim B

Showing 22 results of 22

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 によって変換されたページ (->オリジナル) /