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 11 results of 11

From: Alex <ale...@go...> - 2011年01月26日 22:52:52
Hello to all,
using a standard python install on Ubuntu 10.04 the example fails to 
produce a figure.
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'0.99.1.1'
Test case in python:
from numpy import sin, cos
import matplotlib
import matplotlib.pyplot as plt
plt.matplotlib.rc('text', usetex = True)
import pylab
fig = plt.figure()
ax = fig.add_subplot(111)
t = pylab.linspace(0,10,400)
ax.plot(t, sin(3*t), '-',
 t, sin(0.3*t**2), '--',
 t, cos(t), '-.')
ax.legend((r'$A^{\omega}$', r'$A^{2\omega}$', r'$A^{3\omega}$'),
 shadow = False, loc = (0.75, 0.1))
ax.set_xlabel(r'$\gamma_1 + \gamma_2$', {'fontsize' : 20 })
ax.set_ylabel(r'$A^{n\omega}$ (dB)', {'fontsize' : 20 })
fig.savefig(filename='test.pdf')
This leads to the following traceback:
Traceback (most recent call last):
 File "test.py", line 18, in <module>
 fig.savefig(filename='test.pdf')
 File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1032, 
in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 
1476, in print_figure
 **kwargs)
 File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 
1334, in print_pdf
 return pdf.print_pdf(*args, **kwargs)
 File 
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 
2025, in print_pdf
 self.figure.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in 
draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, 
in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in 
draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in 
draw
 a.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in 
draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 742, in draw
 tick.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in 
draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 196, in draw
 self.label1.draw(renderer)
 File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 553, in draw
 self._fontproperties, angle)
 File 
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 
1431, in draw_tex
 psfont = self.tex_font_mapping(dvifont.texname)
 File 
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py", line 
1264, in tex_font_mapping
 dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
 File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 668, 
in __init__
 self._parse(file)
 File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 701, 
in _parse
 self._register(words)
 File "/usr/lib/pymodules/python2.6/matplotlib/dviread.py", line 727, 
in _register
 assert encoding is None
AssertionError
I assume that the errors happens during parsing of the file 8r.enc 
(http://tug.org/fontname/8r.enc). This file belongs to TexLive 2010 and 
can also be found identically in MikTeX 2.9. I could only reproduce the 
error in Linux so far. Any help would be appreciated.
Alexander
From: C M <cmp...@gm...> - 2011年01月26日 22:41:46
I usually do this for line graphs with markers:
 line, = self.subplot.plot_date(dates,data)
along with some keywords to tweak the plot. I then add line to a
dictionary to keep track of it:
 self.line_to_data_dict[line] = self.activity
But today I tried this with a bar chart, just changing plot_date to
bar and renaming the "line," to "bars,":
 fake_data = [2,2,5]
 bars, = self.subplot.bar(fake_data, fake_data )
This gave me the error: ValueError: too many values to unpack.
OK, so if I removed the comma from "bars," so it is just "bars", it
goes through but then I cannot add it to my dictionary--I get:
> TypeError: list objects are unhashable
Help in understanding this and a better approach would be helpful. Thanks,
Che
From: Shrividya R. <pen...@gm...> - 2011年01月26日 22:37:35
Hi All,
Thanks a bunch for your help!
Eric: your suggestion works brilliantly ( I didn't use the interpolation
kwarg though because I like the 'smudged' look). Paul: thanks for your
suggestions but I get errors when trying to execute > *
cbar.set_ticks(np.linspace(300,350,6))*. The c.bar.set_ticks option doesn't
seem to exist..
All I now need to figure out is how to get the log scale ticklabels to show
for a different imshow plot...
cheers!
Shrividya
From: Thomas L. <thl...@ms...> - 2011年01月26日 22:37:17
Hi,
An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()
HTH,
Thom
**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************
Date: 2011年1月26日 16:03:27 +0800
From: eri...@gm...
To: mat...@li...
Subject: [Matplotlib-users] How to draw a specific country by basemap?
 
 
 
 
 Hi all,
 
 I'm using the Basemap module in matplotlib, it's great to draw a
 world map but for a specific country. Empirically, one can draw its
 own country by specifying the lats and longs like this example:
 http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
 
 And you can use the method: drawcontries() to draw the country
 boundries, but all the countries are in the same colour. Does anyone
 know how to highlight a specific country? Thanks in advance.
 
 Eric
 -- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------
 
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 		 	 		 
From: Soumyaroop R. <sou...@gm...> - 2011年01月26日 22:03:08
Hi there:
Does matplotlib have provide any feature to allow zooming into plot
regions like a waveform viewer does?
regards,
Soumyaroop
From: Eric L. <eri...@gm...> - 2011年01月26日 08:03:42
Hi all,
I'm using the Basemap module in matplotlib, it's great to draw a world
map but for a specific country. Empirically, one can draw its own
country by specifying the lats and longs like this example:
 http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country
boundries, but all the countries are in the same colour. Does anyone
know how to highlight a specific country? Thanks in advance.
Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------
From: Eric F. <ef...@ha...> - 2011年01月26日 07:50:55
On 01/25/2011 08:51 PM, Paul Ivanov wrote:
> Eric Firing, on 2011年01月25日 19:52, wrote:
>> On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
>> [...]
>>> On the same topic of the colorbar, how can I readjust the colors such
>>> that it only goes between user-specified values? For example, I have one
>>> imshow plot where the values range between 0 and 350. However, I only
>>> want to look at the values between 300 and 350.
>>
>> z = np.arange(25)
>> z.shape = 5,5
>> imshow(z, vmin=10, vmax=20, interpolation='nearest')
>> colorbar(extend='both')
>>
>> Does that give the desired result?
>
> Hi Shrividya,
>
> Here's how I interpreted what was being asked, in case that
> helps.
(Your interpretation seems like a very strange thing to want to do, but 
maybe you are right. The OP can inform us.)
>
> Also, Eric, is there a reason we make an outline instead of
> just cbar.ax.set_frame_on? - My manual adjustments screw up and
> confuse whatever data cbar.outline depends on
Yes, we need to make our own outline because a colorbar does not have to 
be a rectangle; it can be pointed at either end or both ends.
Eric
>
> x = np.random.rand(100)
> y = np.random.rand(100)
> z = np.random.rand(100)
> collection = plt.scatter(x, y, c=z*350, vmin=0, vmax=350)
> cbar = plt.colorbar()
> cbar.ax.set_ylim(cbar.norm((300,350)))
> cbar.ax.set_xlim(cbar.norm((300,350))) # maintain aspect ratio
> cbar.set_ticks(np.linspace(300,350,6))
> # didn't see a quick way to fix the outline
> cbar.outline.set_visible(False)
> cbar.ax.set_frame_on(True)
> plt.draw()
>
> best,
>
From: Paul I. <piv...@gm...> - 2011年01月26日 06:51:18
Eric Firing, on 2011年01月25日 19:52, wrote:
> On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
> [...]
> > On the same topic of the colorbar, how can I readjust the colors such
> > that it only goes between user-specified values? For example, I have one
> > imshow plot where the values range between 0 and 350. However, I only
> > want to look at the values between 300 and 350.
> 
> z = np.arange(25)
> z.shape = 5,5
> imshow(z, vmin=10, vmax=20, interpolation='nearest')
> colorbar(extend='both')
> 
> Does that give the desired result?
Hi Shrividya,
Here's how I interpreted what was being asked, in case that
helps. 
Also, Eric, is there a reason we make an outline instead of
just cbar.ax.set_frame_on? - My manual adjustments screw up and
confuse whatever data cbar.outline depends on
x = np.random.rand(100)
y = np.random.rand(100)
z = np.random.rand(100)
collection = plt.scatter(x, y, c=z*350, vmin=0, vmax=350)
cbar = plt.colorbar()
cbar.ax.set_ylim(cbar.norm((300,350)))
cbar.ax.set_xlim(cbar.norm((300,350))) # maintain aspect ratio
cbar.set_ticks(np.linspace(300,350,6))
# didn't see a quick way to fix the outline
cbar.outline.set_visible(False) 
cbar.ax.set_frame_on(True)
plt.draw()
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Eric F. <ef...@ha...> - 2011年01月26日 05:52:35
On 01/25/2011 06:58 PM, Shrividya Ravi wrote:
[...]
> On the same topic of the colorbar, how can I readjust the colors such
> that it only goes between user-specified values? For example, I have one
> imshow plot where the values range between 0 and 350. However, I only
> want to look at the values between 300 and 350.
z = np.arange(25)
z.shape = 5,5
imshow(z, vmin=10, vmax=20, interpolation='nearest')
colorbar(extend='both')
Does that give the desired result?
Eric
>
> Any help would be greatly appreciated!
>
> Thanks a lot!
> Shrividya
From: Shrividya R. <pen...@gm...> - 2011年01月26日 04:59:04
Hi there,
I too want a log scale on the colorbar for an imshow plot. I have tried the
solution proposed by Jae-Joon but I cannot get the ticklabels to show. I
have tried to dynamically change the matplotlibrc settings in ipython using
mpl.rc('text',usetex=True) - where mpl = matplotlib. When I run the script I
get a whole series of errors (see in italics below) and the figure doesn't
show.
*
RuntimeError: Could not obtain dvipng version
Exception in Tkinter callback
*
Is there another way to get a colorbar with a log scale?
On the same topic of the colorbar, how can I readjust the colors such that
it only goes between user-specified values? For example, I have one imshow
plot where the values range between 0 and 350. However, I only want to look
at the values between 300 and 350.
Any help would be greatly appreciated!
Thanks a lot!
Shrividya
Hi Paul,
Sorry for the delayed response....
On Fri, Jan 21, 2011 at 5:20 PM, Paul Ivanov <piv...@gm...> wrote:
> ok, much clearer now - what you want is for your text to not be
> cut-off the way it is in the 8x8 80dpi plot? In other words,
> there's not enough space left in the figure for the axis labels
> to be completely displayed.
Even if the text was displayed, it appears to be rather smaller than
it could be.
> At the moment, I don't think there's a simple way of doing it,
> and the quick way I find myself doing is by adjusting the subplot
> parameters using:
Thanks for helping me so much with this. I'll continue to use my
convert hack until better things come down the pipe. Sorry that I am
not able to write patches to help this situation. :(
daryl

Showing 11 results of 11

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