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

Showing 8 results of 8

From: Michael D. <md...@st...> - 2013年08月27日 19:04:37
On 08/27/2013 09:49 AM, Chris Beaumont wrote:
> I've been burned by this before as well. MPL stores some intermediate 
> data products (for example, scaled RGB copies) at full resolution, 
> even though the final rendered image is downsampled depending on 
> screen resolution.
>
> I've used some hacky tricks to get around this, which mostly involve 
> downsampling the image on the fly based on screen resolution. One such 
> effort is at https://github.com/ChrisBeaumont/mpl-modest-image.
It looks like this wouldn't be too hard to include in matplotlib. I 
don't think we'd want to change the current behavior, because sometimes 
its tradeoff curve makes sense, but in other cases, the "modest image" 
approach also makes sense. It's just a matter of coming up with an API 
to switch between the two behaviors. Pull request?
Cheers,
Mike
>
> If you are loading your arrays from disk, you can also use 
> memory-mapped arrays -- this prevents you from loading all the data 
> into RAM, and further cuts down on the footprint.
>
> cheers,
> chris
>
>
> On Tue, Aug 27, 2013 at 6:49 AM, S(te(pán Turek 
> <ste...@se... <mailto:ste...@se...>> wrote:
>
>
> You could look at whether or not you actually need 64-bit
> precision. Often times, 8-bit precision per color channel is
> justifiable, even in grayscale. My advice is to play with the
> dtype of your array or, as you mentioned, resample.
>
>
> thanks, this helped me significantly, uint8 precision is enough.
>
> Also, is it needed to keep all images? It sounds to me like
> your application will become very resource hungry if you're
> going to be displaying several of these 2D images over each
> other (and if you don't use transparency, you won't get any
> benefit at all from plotting them together).
>
>
> Yes, I need them all .
>
> To avoid it I am thinking about merging them into one image and
> then plot it.
>
>
> Stepan
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance
> Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Chris B. <cbe...@cf...> - 2013年08月27日 13:49:20
I've been burned by this before as well. MPL stores some intermediate data
products (for example, scaled RGB copies) at full resolution, even though
the final rendered image is downsampled depending on screen resolution.
I've used some hacky tricks to get around this, which mostly involve
downsampling the image on the fly based on screen resolution. One such
effort is at https://github.com/ChrisBeaumont/mpl-modest-image.
If you are loading your arrays from disk, you can also use memory-mapped
arrays -- this prevents you from loading all the data into RAM, and further
cuts down on the footprint.
cheers,
chris
On Tue, Aug 27, 2013 at 6:49 AM, Štěpán Turek <ste...@se...>wrote:
>
> You could look at whether or not you actually need 64-bit precision. Often
> times, 8-bit precision per color channel is justifiable, even in grayscale.
> My advice is to play with the dtype of your array or, as you mentioned,
> resample.
>
>
> thanks, this helped me significantly, uint8 precision is enough.
>
>
>
> Also, is it needed to keep all images? It sounds to me like your
> application will become very resource hungry if you're going to be
> displaying several of these 2D images over each other (and if you don't use
> transparency, you won't get any benefit at all from plotting them together).
>
>
> Yes, I need them all .
>
> To avoid it I am thinking about merging them into one image and then plot
> it.
>
>
> Stepan
>
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Štěpán T. <ste...@se...> - 2013年08月27日 10:50:04
"
""
You could look at whether or not you actually need 64-bit precision. Often 
times, 8-bit precision per color channel is justifiable, even in grayscale. 
My advice is to play with the dtype of your array or, as you mentioned, 
resample. 
"
thanks, this helped me significantly, uint8 precision is enough.
 
"
Also, is it needed to keep all images? It sounds to me like your application
will become very resource hungry if you're going to be displaying several of
these 2D images over each other (and if you don't use transparency, you won'
t get any benefit at all from plotting them together).
"
Yes, I need them all .
To avoid it I am thinking about merging them into one image and then plot 
it. 
Stepan
"
 
"
From: Oliver <oli...@gm...> - 2013年08月27日 10:26:42
Those numbers actually make a lot of sense.
For a 4k by 4k 2D array of 64-bit floats, you're using 128MiB of memory,
just to store them. Displaying such an array with mpl would take a copy of
that and add some objects for housekeeping (on my machine about 150MB to
display one such array together with the housekeeping objects).
You could look at whether or not you actually need 64-bit precision. Often
times, 8-bit precision per color channel is justifiable, even in grayscale.
My advice is to play with the dtype of your array or, as you mentioned,
resample.
Also, is it needed to keep all images? It sounds to me like your
application will become very resource hungry if you're going to be
displaying several of these 2D images over each other (and if you don't use
transparency, you won't get any benefit at all from plotting them together).
2013年8月27日 Štěpán Turek <ste...@se...>
> Hi,
>
>
> You could, before plotting, sum the different image arrays? Depending on
> whether you are plotting RGB(A) images or greyscale images, you could take
> the sum of the color channels, or take a weighted average.
>
>
> Yes, I will probably merge the images (RGBA) before plotting. I want to
> create more plots and even with this optimization every plot will take 300
> MB... Is there any way how to save some memory?
>
>
> Best
>
> Stepan
>
>
>
From: Štěpán T. <ste...@se...> - 2013年08月27日 08:37:14
Hi,
"
You could, before plotting, sum the different image arrays? Depending on 
whether you are plotting RGB(A) images or greyscale images, you could take 
the sum of the color channels, or take a weighted average. 
"
Yes, I will probably merge the images (RGBA) before plotting. I want to 
create more plots and even with this optimization every plot will take 300 
MB... Is there any way how to save some memory?
Best
Stepan 
 
From: Nicolas M. <nic...@la...> - 2013年08月27日 08:28:24
Le Lun 26 août 2013 18:21, Goyo a écrit :
> 2013年7月19日 Nicolas Mailhot <nic...@la...>:
>> Le Mer 17 juillet 2013 14:56, Michael Droettboom a écrit :
>>> Can you please provide a completely standalone example? The following
>>> code has undefined variables etc.
>>
>> Here it is, I'm afraid this testcase intent is less clear than what I
>> pasted previously (I replaced variables with precomputed values)
>>
>> As shown in the attached png, the bottom tick labels (month names) are
>> missing. It worked in matplotlib ≤ 1.2.0
>
> I can confirm the issue with 1.2.1 but it works with a recent
> development version (output attached) so it must have been fixed at
> some point.
Thank you very much for the data point, I'll try to get 1.3.0 built on RHEL 6
Regards,
-- 
Nicolas Mailhot
From: Oliver <oli...@gm...> - 2013年08月27日 08:14:10
You could, before plotting, sum the different image arrays? Depending on
whether you are plotting RGB(A) images or greyscale images, you could take
the sum of the color channels, or take a weighted average.
The method you use here depends strongly on the image type, but it will
reduce memory consumption.
Just a thought.
2013年8月27日 Štěpán Turek <ste...@se...>
> Hi,
>
> I would like to plot multiple overlayed 4096x4096 images in one axes. If I
> run this code the plot takes 300 MB of memory:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> if __name__ == '__main__':
> img = np.zeros((4096, 4096))
> img[100: 300, 100:1500] = 200
> imgplot = plt.imshow(img)
>
> plt.show()
>
> And it takes additional 300 MB for every image with this size added into
> plot. Is there any way to reduce memory consumption without need of data
> resampling?
>
> My configuration:
> Matplotlib 1.2.1
> Numpy 1.7.1
> Ubuntu 13.04 64 bit
>
> Best
> Stepan
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Štěpán T. <ste...@se...> - 2013年08月27日 07:56:31
Hi,
I would like to plot multiple overlayed 4096x4096 images in one axes. If I 
run this code the plot takes 300 MB of memory:
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
  img = np.zeros((4096, 4096))
  img[100: 300, 100:1500] = 200
  imgplot = plt.imshow(img)
  plt.show()
And it takes additional 300 MB for every image with this size added into 
plot. Is there any way to reduce memory consumption without need of data 
resampling?
My configuration:
Matplotlib 1.2.1
Numpy 1.7.1
Ubuntu 13.04 64 bit
Best
Stepan

Showing 8 results of 8

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