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



Showing 11 results of 11

From: elmar w. <el...@ne...> - 2012年10月19日 21:51:57
Am 19.10.2012 23:26, schrieb Damon McDougall:
> Correct me if I'm wrong, but I don't even think you need them. I think
> the default cmap behaviour is to normalise to the min and max of the
> data.
yes, default cmap behaviour will normalise to the min and max of the
data.
From: Damon M. <dam...@gm...> - 2012年10月19日 21:26:12
On Fri, Oct 19, 2012 at 10:23 PM, Daπid <dav...@gm...> wrote:
> On Fri, Oct 19, 2012 at 11:08 PM, elmar werling <el...@ne...> wrote:
>> vmin=min(z), vmax=max(z)
>
> A suggestion, when dealing with arrays, it is generally faster to use
> the numpy function to compute the max and min, either np.max(z) or
> z.max(), than the standard Python one.
Correct me if I'm wrong, but I don't even think you need them. I think
the default cmap behaviour is to normalise to the min and max of the
data.
-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Daπid <dav...@gm...> - 2012年10月19日 21:24:05
On Fri, Oct 19, 2012 at 11:08 PM, elmar werling <el...@ne...> wrote:
> vmin=min(z), vmax=max(z)
A suggestion, when dealing with arrays, it is generally faster to use
the numpy function to compute the max and min, either np.max(z) or
z.max(), than the standard Python one.
From: elmar w. <el...@ne...> - 2012年10月19日 21:19:16
thanks for help,
finally I found the following solution
elmar
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
N = 200
x = np.linspace(0,1,N)
y = np.random.randn(N)
z = np.random.randn(N)*2+5
cm = mpl.cm.get_cmap('RdYlBu')
sc = plt.scatter(x, y, c=z, vmin=min(z), vmax=max(z), s=35, cmap=cm)
plt.colorbar(sc)
plt.show()
Am 19.10.2012 21:59, schrieb Joe Kington:
> plt.scatter(x, y, c=z, marker='s')
> plt.colorbar()
From: Joe K. <jki...@wi...> - 2012年10月19日 19:59:25
That's what ``scatter`` is intended for.
Basically, you want something like:
 plt.scatter(x, y, c=z, marker='s')
 plt.colorbar()
Note that you can also vary the markers by size based on an additional
parameter, as well.
Have a look at this example:
http://matplotlib.org/examples/pylab_examples/scatter_demo.html
Hope that helps,
-Joe
On Fri, Oct 19, 2012 at 2:19 PM, elmar werling <el...@ne...> wrote:
> Hi,
>
> is there a way to adjust the marker color in a xy-plot in relation to
> the value of a third parameter. Something as the following - not working
> - example 1.
>
> Example 2 is working but rather slow for large arrays.
>
> cheers
> Elmar
>
>
>
>
> # example 1
>
> import matplotlib.pyplot as plt
>
> x = [1,2,3,4]
> y = x
> c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3))
>
> plt.plot(x,y, color=c, marker='s')
> plt.show()
>
>
> example 2:
>
> import matplotlib.pyplot as plt
>
> x = [1,2,3,4]
> y = x
> c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3))
>
> for i in range(len(x)):
> plt.plot(x[i], y[i], color=c[i], marker='s')
>
> plt.show()
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: elmar w. <el...@ne...> - 2012年10月19日 19:17:41
Hi,
is there a way to adjust the marker color in a xy-plot in relation to 
the value of a third parameter. Something as the following - not working 
- example 1.
Example 2 is working but rather slow for large arrays.
cheers
Elmar
# example 1
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = x
c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3))
plt.plot(x,y, color=c, marker='s')
plt.show()
example 2:
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = x
c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3))
for i in range(len(x)):
 plt.plot(x[i], y[i], color=c[i], marker='s')
plt.show()
From: Phil E. <pel...@gm...> - 2012年10月19日 15:35:01
Good idea. If the png version works then the jpg version should also be
made to work,
Would you be willing to open up an issue for the feature request? :
https://github.com/matplotlib/matplotlib/issues/new
If your ready and willing to implement such a thing, that would be even
better (just open a pull request and we can start reviewing)!
All the best,
Phil
On 19 October 2012 15:59, Rich Signell <rsi...@us...> wrote:
> MPL folks,
>
> Would it be possible to enhance Matplotlib to allow "im=imread(url)"
> to work if url returns a JPG?
>
> Currently (it seems):
>
> 1. If the URL returns a PNG this works:
>
> im = imread(urllib2.urlopen(url))
>
> 2. If the URL returns a JPG, this DOESN'T work:
>
> im = imread(urllib2.urlopen(url))
>
> .. and neither does this:
> im = imread(urllib2.urlopen(url),format='jpg')
>
> ... but this DOES work:
>
> im = Image.open(cStringIO.StringIO(urllib.urlopen(url).read()))
>
> See an example in Ipython Notebook here:
> http://nbviewer.ipython.org/3918576/
>
> So could just be hidden from the user so that "im = imread(url)" would
> just work for JPG (assuming PIL was installed)?
>
> Thanks,
> Rich
> --
> Dr. Richard P. Signell
> USGS, 384 Woods Hole Rd.
> Woods Hole, MA 02543-1598
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Pierre H. <pie...@cr...> - 2012年10月19日 15:11:29
Hi,
Le 19/10/2012 06:48, Jae-Joon Lee a écrit :
> Figuring out the dpi of the screen, I have no clue at this moment.
> Maybe this is something a gui expert can answer.
I'm certainly not a gui expert, but as a PyQt user, I know screen
resolution is indeed Python-accessible with PyQt. (I guess other
toolkits provide their own methods)
I've made a quick script that prints the screen X and Y resolution
(requires PyQt). Reference links to PyQt API docs are included.
In my case, it's 96 dpi, and that what I use in my matplotlibrc file for
the "figure.dpi" property. But I use a higher value (say 150) for
"savefig.dpi" so that I get better resolution when saving PNG images.
I agree with Nikolaus that the dpi value for displaying figures would be
better get by the software, if possible. Maybe a property like
figure.dpi='auto' should activate such a behavior. But this would
require many code duplicates, one for each gui toolkit.
Best,
Pierre
From: Rich S. <rsi...@us...> - 2012年10月19日 14:59:18
MPL folks,
Would it be possible to enhance Matplotlib to allow "im=imread(url)"
to work if url returns a JPG?
Currently (it seems):
1. If the URL returns a PNG this works:
im = imread(urllib2.urlopen(url))
2. If the URL returns a JPG, this DOESN'T work:
im = imread(urllib2.urlopen(url))
.. and neither does this:
im = imread(urllib2.urlopen(url),format='jpg')
... but this DOES work:
im = Image.open(cStringIO.StringIO(urllib.urlopen(url).read()))
See an example in Ipython Notebook here:
http://nbviewer.ipython.org/3918576/
So could just be hidden from the user so that "im = imread(url)" would
just work for JPG (assuming PIL was installed)?
Thanks,
Rich
-- 
Dr. Richard P. Signell
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598
From: Jae-Joon L. <lee...@gm...> - 2012年10月19日 04:49:04
> Yeah, that's what I feared. But in the mean time, are there any best
> practices to minimize undesired effects like the one above? For example,
> are there any other functions that need special parameters to not raster
> their output when writing to a vector format? And is there a way to get
> a figure on the screen with the right size when I don't know what dpi
> the monitor is running with?
As I said, if you use interpolation="none" with your inshow, the
original image will be sent to the backends.
Figuring out the dpi of the screen, I have no clue at this moment.
Maybe this is something a gui expert can answer.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2012年10月19日 04:36:56
On Tue, Oct 16, 2012 at 4:04 PM, T J <tj...@gm...> wrote:
> I'm interested in clipping the result of plt.contour (and
> plt.contourf) to a patch. However, QuadContourSet does not have a
> set_clip_path() method. Is there a way to do this?
QuadContourSet does not (I think it should), but LineCollection
instances in QuadContourSet.collections does. Below is a quick
example.
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(100)-50
arr = (x**2 + x[:,np.newaxis]**2)**.5
cont = plt.contour(arr)
col1 = cont.collections[3] # contour line to clip with.
clip_path = col1.get_paths()[0] # Note that col1 may have multiple paths.
for col in cont.collections:
 col.set_clip_path(clip_path, col1.get_transform()) # set clip_path
for individual LineCollection instances.
plt.show()

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