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
|
|
From: Michael D. <md...@st...> - 2013-10-18 13:40:38
|
This is really puzzling. What version of matplotlib are you running,
what platform, and what version of Python? Your example works just fine
for me.
Mike
On 10/18/2013 08:40 AM, Neal Becker wrote:
> Neal Becker wrote:
>
>> This example shows the error on my platform - the xlabel is not rendered with
>> tex but instead the '$' are printed:
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> plt.xkcd()
>>
>> fig = fig = plt.figure()
>> ax = fig.add_subplot(111)
>> plt.plot (np.arange (10), 2*np.arange(10))
>> ax.set_xlabel ('$E_{s}/N_{0}$')
>> plt.show()
>>
>>
> And without plt.xkcd() the tex is rendered correctly
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
_
|\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _
| ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
http://www.droettboom.com
|
|
From: Neal B. <ndb...@gm...> - 2013-10-18 12:45:14
|
Neal Becker wrote:
> This example shows the error on my platform - the xlabel is not rendered with
> tex but instead the '$' are printed:
>
> import numpy as np
> import matplotlib.pyplot as plt
> plt.xkcd()
>
> fig = fig = plt.figure()
> ax = fig.add_subplot(111)
> plt.plot (np.arange (10), 2*np.arange(10))
> ax.set_xlabel ('$E_{s}/N_{0}$')
> plt.show()
>
>
And without plt.xkcd() the tex is rendered correctly
|
|
From: Neal B. <ndb...@gm...> - 2013-10-18 12:39:06
|
Michael Droettboom wrote:
> On 10/18/2013 08:20 AM, Neal Becker wrote:
>> Michael Droettboom wrote:
>>
>>> The built-in mathtext support does. (I can put "xkcd()" at the top of
>>> the mathtext_demo.py example and all is well).
>>>
>>> It does not work when |text.usetex| is True (when using external TeX).
>>> But in that case, it should have thrown an exception:
>>>
>>> |Traceback (most recent call last):
>>> File "mathtext_demo.py", line 9, in <module>
>>> xkcd()
>>> File
>>> "/home/mdboom/python/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-
>> linux-x86_64.egg/matplotlib/pyplot.py",
>>> line 293, in xkcd
>>> "xkcd mode is not compatible with text.usetex = True")
>>> RuntimeError: xkcd mode is not compatible with text.usetex = True|
>>>
>>> Mike
>>>
>>> On 10/18/2013 07:24 AM, Neal Becker wrote:
>>>
>>>> It appears that latex doesn't work with xkcd?
>>>>
>>>> I put for example:
>>>> self.ax.set_xlabel ('$E_s/N_0
>>>>
>>>>
>>>> )
>>>>
>>>> Which go rendered with the '
>>>>
>>>>
>>>> signs and not as latex
>>>>
>>>> And my vertical axis was labeled as:
>>>>
>>>> $\mathdefault{10^{3}}$ ...
>>>>
>>>>
>> Strange. I don't have anything about usetex in the script, or in my
>> .matplotlibrc - all it has is:
>>
>> backend : Qt4Agg
>> mathtext.fontset: stix
>>
>>
>
> Puzzling. Do you have a matplotlibrc in the current working directory?
>
No. Also tried removing .matplotlibrc (in ~/.matplotlib).
|
|
From: Christoph G. <chr...@gr...> - 2013-10-18 12:34:57
|
Hello, The script pasted below plots a square array. The (very small) output PDF is attached to this posting. For reasons I do not understand, there's a fine additional border immediately at the top and bottom of the array. If the commented-out line of code is removed, the strange border disappears. Now you will ask, why do I create the figure in this way and don't simply use the commented-out line? The answer is that this script is a simplified version of the function "map" from http://git.kwant-project.org/kwant/tree/kwant/plotter.py?id=v1.0.0 There, we need to create a figure also when pyplot has not been imported. If we would import matplotlib.pyplot, the user of our package could not freely choose the matplotlib backend himself. Thanks, Christoph **************************************************************** import numpy as np from matplotlib import pyplot from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg data = np.random.random((11, 11)) fig = Figure() ax = fig.add_subplot(1, 1, 1, aspect='equal', adjustable='datalim') # Uncommenting the following line makes it work. # fig, ax = pyplot.subplots() image = ax.imshow(data, extent=(-49.5, 49.5, -49.5, 49.5), interpolation='none') fig.canvas = FigureCanvasAgg(fig) fig.set_size_inches(5, 5) fig.savefig('test.pdf') |
|
From: Michael D. <md...@st...> - 2013-10-18 12:26:38
|
On 10/18/2013 08:20 AM, Neal Becker wrote:
> Michael Droettboom wrote:
>
>> The built-in mathtext support does. (I can put "xkcd()" at the top of
>> the mathtext_demo.py example and all is well).
>>
>> It does not work when |text.usetex| is True (when using external TeX).
>> But in that case, it should have thrown an exception:
>>
>> |Traceback (most recent call last):
>> File "mathtext_demo.py", line 9, in <module>
>> xkcd()
>> File
>> "/home/mdboom/python/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-
> linux-x86_64.egg/matplotlib/pyplot.py",
>> line 293, in xkcd
>> "xkcd mode is not compatible with text.usetex = True")
>> RuntimeError: xkcd mode is not compatible with text.usetex = True|
>>
>> Mike
>>
>> On 10/18/2013 07:24 AM, Neal Becker wrote:
>>
>>> It appears that latex doesn't work with xkcd?
>>>
>>> I put for example:
>>> self.ax.set_xlabel ('$E_s/N_0
>>>
>>>
>>> )
>>>
>>> Which go rendered with the '
>>>
>>>
>>> signs and not as latex
>>>
>>> And my vertical axis was labeled as:
>>>
>>> $\mathdefault{10^{3}}$ ...
>>>
>>>
> Strange. I don't have anything about usetex in the script, or in my
> .matplotlibrc - all it has is:
>
> backend : Qt4Agg
> mathtext.fontset: stix
>
>
Puzzling. Do you have a matplotlibrc in the current working directory?
Mike
--
_
|\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _
| ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
http://www.droettboom.com
|
|
From: Neal B. <ndb...@gm...> - 2013-10-18 12:25:56
|
This example shows the error on my platform - the xlabel is not rendered with
tex but instead the '$' are printed:
import numpy as np
import matplotlib.pyplot as plt
plt.xkcd()
fig = fig = plt.figure()
ax = fig.add_subplot(111)
plt.plot (np.arange (10), 2*np.arange(10))
ax.set_xlabel ('$E_{s}/N_{0}$')
plt.show()
Michael Droettboom wrote:
> The built-in mathtext support does. (I can put "xkcd()" at the top of
> the mathtext_demo.py example and all is well).
>
> It does not work when |text.usetex| is True (when using external TeX).
> But in that case, it should have thrown an exception:
>
> |Traceback (most recent call last):
> File "mathtext_demo.py", line 9, in <module>
> xkcd()
> File
> "/home/mdboom/python/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-
linux-x86_64.egg/matplotlib/pyplot.py",
> line 293, in xkcd
> "xkcd mode is not compatible with text.usetex = True")
> RuntimeError: xkcd mode is not compatible with text.usetex = True|
>
> Mike
>
> On 10/18/2013 07:24 AM, Neal Becker wrote:
>
>> It appears that latex doesn't work with xkcd?
>>
>> I put for example:
>> self.ax.set_xlabel ('$E_s/N_0
>>
>>
>> )
>>
>> Which go rendered with the '
>>
>>
>> signs and not as latex
>>
>> And my vertical axis was labeled as:
>>
>> $\mathdefault{10^{3}}$ ...
>>
>>
>>
------------------------------------------------------------------------------
>> October Webinars: Code for Performance
>> Free Intel webinars can help you accelerate application performance.
>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
>> the latest Intel processors and coprocessors. See abstracts and register >
>> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Neal B. <ndb...@gm...> - 2013-10-18 12:20:39
|
Michael Droettboom wrote:
> The built-in mathtext support does. (I can put "xkcd()" at the top of
> the mathtext_demo.py example and all is well).
>
> It does not work when |text.usetex| is True (when using external TeX).
> But in that case, it should have thrown an exception:
>
> |Traceback (most recent call last):
> File "mathtext_demo.py", line 9, in <module>
> xkcd()
> File
> "/home/mdboom/python/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-
linux-x86_64.egg/matplotlib/pyplot.py",
> line 293, in xkcd
> "xkcd mode is not compatible with text.usetex = True")
> RuntimeError: xkcd mode is not compatible with text.usetex = True|
>
> Mike
>
> On 10/18/2013 07:24 AM, Neal Becker wrote:
>
>> It appears that latex doesn't work with xkcd?
>>
>> I put for example:
>> self.ax.set_xlabel ('$E_s/N_0
>>
>>
>> )
>>
>> Which go rendered with the '
>>
>>
>> signs and not as latex
>>
>> And my vertical axis was labeled as:
>>
>> $\mathdefault{10^{3}}$ ...
>>
>>
Strange. I don't have anything about usetex in the script, or in my
.matplotlibrc - all it has is:
backend : Qt4Agg
mathtext.fontset: stix
|
|
From: Christoph G. <chr...@gr...> - 2013-10-18 12:19:56
|
Nicolas Rougier writes: > Would something like this suit your needs ? > > (...) Thanks. Setting figsize is indeed the way to achieve (almost) what I wanted. My other followup in this thread describes the remaining issue. |
|
From: Christoph G. <chr...@gr...> - 2013-10-18 12:10:13
|
Joe, thank you very much for your reply. So the "figsize" of a matplotlib plot is the physical size of the region between the axes where the data is shown? If this is indeed the case, as it seems, then achieving (almost) what I wanted is as easy as setting a figsize with the proper aspect ratio, like in your example. Before your reply, I believed that "figure size" in matplotlib refers to the size of the whole figure (including axes, axis labels, and borders), as "figure" in matplotlib seems to be a name for instances of matplotlib.figure.Figure which are the whole thing. I said "almost" in the first paragraph as it would be nice if there was a way to create figures that have a given total width (after cropping) at a given font size. The reason is this: In many scientific journals (for example Physical Review), figures are scaled to have the same width as a column of text. If I prepare a bunch of figures with the same width "within the axes" and consistent font sizes and line widths, the resulting figures will typically have somewhat different total widths. After scaling the figures to the same width, the font sizes and line widths will differ slightly from figure to figure. Christoph |
|
From: Michael D. <md...@st...> - 2013-10-18 11:44:31
|
The built-in mathtext support does. (I can put "xkcd()" at the top of
the mathtext_demo.py example and all is well).
It does not work when |text.usetex| is True (when using external TeX).
But in that case, it should have thrown an exception:
|Traceback (most recent call last):
File "mathtext_demo.py", line 9, in <module>
xkcd()
File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 293, in xkcd
"xkcd mode is not compatible with text.usetex = True")
RuntimeError: xkcd mode is not compatible with text.usetex = True|
Mike
On 10/18/2013 07:24 AM, Neal Becker wrote:
> It appears that latex doesn't work with xkcd?
>
> I put for example:
> self.ax.set_xlabel ('$E_s/N_0
>
>
> )
>
> Which go rendered with the '
>
>
> signs and not as latex
>
> And my vertical axis was labeled as:
>
> $\mathdefault{10^{3}}$ ...
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
_
|\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _
| ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
http://www.droettboom.com
|
|
From: Neal B. <ndb...@gm...> - 2013-10-18 11:25:08
|
It appears that latex doesn't work with xkcd?
I put for example:
self.ax.set_xlabel ('$E_s/N_0$')
Which go rendered with the '$' signs and not as latex
And my vertical axis was labeled as:
$\mathdefault{10^{3}}$ ...
|
|
From: Matthias B. <bus...@gm...> - 2013-10-17 19:33:47
|
> In the process, I also skimmed the 1.3 release notes. What's this? How > was it that I missed the new xkcd style??? Did you know about http://matplotlib.org/xkcd/gallery.html > > I don't know who is responsible for your marketing, but they clearly > need to blanket the world with press releases about this new > functionality. This could be the "killer app" for matplotlib. It has been on frontage of nbviewer for quite some time though, and if you are interested on historical reason on how/when it was created, I suggest you to read http://nbviewer.ipython.org/url/jakevdp.github.com/downloads/notebooks/XKCD_plots.ipynb or http://jakevdp.github.io/blog/2012/10/07/xkcd-style-plots-in-matplotlib/ (highly advise to read jake blog in any case) -- Matthias |
|
From: Skip M. <sk...@po...> - 2013-10-17 19:25:58
|
At work both mpl 1.1 and mpl 1.2 are installed. (I have no idea why.) Vagaries of our current packaging cause problems (import finds 1.1 before 1.2 in sys.path). The question was what to do. I took a look at the latest What's New document and concluded that removing 1.1 would be the best route. In the process, I also skimmed the 1.3 release notes. What's this? How was it that I missed the new xkcd style??? I mentioned this in my reply about the 1.1/1.2 internecine conflict. Almost immediately, I got two responses: "I always preferred GNUplot over matplotlib until I heard there was an xkcd mode in matplotlib." - Vic "I don't use matplotlib but all of a sudden I have the urge to plot something JUST to use the xkcd plotting format." Mark I don't know who is responsible for your marketing, but they clearly need to blanket the world with press releases about this new functionality. This could be the "killer app" for matplotlib. I can't wait until we see xkcd-style plots in "Science" or "The Astrophysical Journal". :-) Skip |
|
From: Nicolas R. <Nic...@in...> - 2013-10-17 15:50:34
|
Would something like this suit your needs ?
import matplotlib.pyplot as plt
# Image size
width,height = 640,480
# Pixel border around image
border = 1
dpi = 72.0
figsize= (width+2*border)/float(dpi), (height+2*border)/float(dpi)
fig = plt.figure(figsize=figsize, dpi=dpi, facecolor="white")
hpixel = 1.0/(width+2*border)
vpixel = 1.0/(height+2*border)
ax = fig.add_axes([border*hpixel, border*vpixel,
1-2*border*hpixel, 1-2*border*vpixel])
ax.set_xlim(0, width)
ax.set_ylim(0, height)
plt.show()
Nicolas
On Oct 17, 2013, at 4:16 PM, Christoph Groth <chr...@gr...> wrote:
> Benjamin Root writes:
>
>> I particularly like using the figaspect() function:
>>
>> (...)
>>
>> It isn't perfect, but for its simplicity, it gets it mostly right.
>
> Thanks, Benjamin, for your quick reply.
>
> Unfortunately, figaspect is only an approximate solution, as it simply
> uses the aspect ration of the image for the whole figure (with axes and
> labels).
>
> I wonder how difficult it would be to teach matplotlib to tightly fit
> the axes around an image, and, ideally, output the figure cropped.
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Joe K. <jof...@gm...> - 2013-10-17 15:46:00
|
<snip>
>
> Unfortunately, figaspect is only an approximate solution, as it simply
> uses the aspect ration of the image for the whole figure (with axes and
> labels).
>
> I wonder how difficult it would be to teach matplotlib to tightly fit
> the axes around an image, and, ideally, output the figure cropped.
>
So, you're wanting the image to be displayed pixel-to-pixel, but still have
(tight) room for the axes, etc?
If so, you can use the "bbox_inches" kwarg to crop "out" and capture the
extent of the labels, etc, and just set the figure size to exactly the size
of the image.
For example:
import numpy as np
import matplotlib.pyplot as plt
dpi = 80
data = np.random.random((100, 100))
height, width = np.array(data.shape, dtype=float) / dpi
fig, ax = plt.subplots(figsize=(width, height), dpi=dpi)
ax.imshow(data, interpolation='none')
fig.savefig('test.png', bbox_inches='tight')
If show the figure (i.e. "plt.show()"), the ticklabels, etc will be outside
the figure and not shown, but they will be properly saved, regardless.
Hope that helps,
-Joe
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Christoph G. <chr...@gr...> - 2013-10-17 14:45:12
|
Benjamin Root writes: > I particularly like using the figaspect() function: > > (...) > > It isn't perfect, but for its simplicity, it gets it mostly right. Thanks, Benjamin, for your quick reply. Unfortunately, figaspect is only an approximate solution, as it simply uses the aspect ration of the image for the whole figure (with axes and labels). I wonder how difficult it would be to teach matplotlib to tightly fit the axes around an image, and, ideally, output the figure cropped. |
|
From: Benjamin R. <ben...@ou...> - 2013-10-17 13:28:32
|
On Thu, Oct 17, 2013 at 8:20 AM, Christoph Groth <cw...@fa...> wrote: > Hello, > > I'm stuck trying to find a solution to the following problem. > > I'd like to show an array using imshow preserving the 1:1 aspect ratio > of its pixels. At the same time, I would like the axes to fit around > the image tightly. > > Is there some way to, for example, choose a certain figure width, and > have the height chosen automatically to the optimal value? > > Thanks, > Christoph > > I particularly like using the figaspect() function: http://matplotlib.org/api/figure_api.html?highlight=figaspect#matplotlib.figure.figaspect The example usage there needs to be updated (it assumes the pylab mode which imports everything in pyplot into the global namespace). But it should be accessible like so: import matplotlib.pyplot as plt w, h = plt.figaspect(2) It isn't perfect, but for its simplicity, it gets it mostly right. Cheers! Ben Root |
|
From: Christoph G. <cw...@fa...> - 2013-10-17 12:20:37
|
Hello, I'm stuck trying to find a solution to the following problem. I'd like to show an array using imshow preserving the 1:1 aspect ratio of its pixels. At the same time, I would like the axes to fit around the image tightly. Is there some way to, for example, choose a certain figure width, and have the height chosen automatically to the optimal value? Thanks, Christoph |
|
From: Sterling S. <sm...@fu...> - 2013-10-15 17:44:38
|
Nils,
Here is a version that runs through. It produces two different versions of your graph: one with the colors corresponding to the index of the arrays, the other with the colors corresponding to the value of the histogram. I hope this helps.
-Sterling
{{{
import re
import os
import sys
import gzip
import numpy as np
import matplotlib.pyplot as plt
import glob
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.colors as colors
import matplotlib.cm as cmx
efratio = np.loadtxt('efratio-10.dat.gz')
hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
width = 0.7*(bin_edges[1]-bin_edges[0])
center = (bin_edges[:-1]+bin_edges[1:])/2
coolwarm = cm = plt.get_cmap('coolwarm')
values = range(100)
for normed in [values,hist]:
cNorm = colors.Normalize(vmin=0, vmax=max(normed))
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
colours = []
for value in normed:
colorVal = scalarMap.to_rgba(value)
colours.append(colorVal)
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
heatmap = ax.bar(center, hist, zs=1, zdir='y', align = 'center', width = width,color=colours,linewidth=0)
scalarMap.set_array(normed)
plt.colorbar(scalarMap,ax=ax)
plt.show()
}}}
On Oct 14, 2013, at 6:12AM, Nils Wagner wrote:
> Here is a self contained version.
>
> Nils
>
>
>
>
> On Fri, Oct 11, 2013 at 4:33 PM, Sterling Smith <sm...@fu...> wrote:
> Nils,
>
> I tried to run your example, but there are some variables which are undefined. Can you post a self contained revision of your example?
>
> -Sterling
>
> On Oct 11, 2013, at 1:34AM, Nils Wagner wrote:
>
> > plt.colorbar(scalarMap,ax=ax) results in
> >
> > cm.py", line 309, in autoscale_None
> > raise TypeError('You must first set_array for mappable')
> > TypeError: You must first set_array for mappable
> >
> > Nils
> >
> >
> >
> > On Fri, Oct 11, 2013 at 9:51 AM, Eric Firing <ef...@ha...> wrote:
> > On 2013/10/10 8:52 PM, Nils Wagner wrote:
> > > Hi all,
> > >
> > > I tried to add a colorbar to a bar plot
> > >
> > > coolwarm = cm = plt.get_cmap('coolwarm')
> > > values = range(100)
> > > cNorm = colors.Normalize(vmin=0, vmax=values[-1])
> > > scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=coolwarm)
> > > colours = []
> > > for value in values:
> > > colorVal = scalarMap.to_rgba(value)
> > > colours.append(colorVal)
> > >
> > > fig = plt.figure()
> > > ax = fig.add_subplot(111,projection='3d')
> > > hist,bin_edges = np.histogram(efratio,bins=100,range=(0.,1.),density=False)
> > > width = 0.7*(bin_edges[1]-bin_edges[0])
> > > center = (bin_edges[:-1]+bin_edges[1:])/2
> > > heatmap = ax.bar(center, hist, zs=z, zdir='y', align = 'center', width =
> > > width,color=colours)
> > > plt.colorbar(heatmap)
> > >
> > >
> > >
> > >
> > >
> > > mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
> > > AttributeError: 'BarContainer' object has no attribute 'autoscale_None'
> >
> > This is because it is not an instance of ScalarMappable, which is what
> > colorbar() requires as its argument.
> > >
> > > How can I fix the problem ?
> >
> > Use scalarMap as the argument instead of heatmap. I think you will need
> > to provide either the cax or the ax kwarg in addition.
> >
> > examples/api/colorbar_only.py might also be helpful.
> >
> > Eric
> > >
> > > Nils
> > >
> > >
> > >
> > > ------------------------------------------------------------------------------
> > > October Webinars: Code for Performance
> > > Free Intel webinars can help you accelerate application performance.
> > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> > > the latest Intel processors and coprocessors. See abstracts and register >
> > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> > >
> > >
> > >
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> >
> >
> > ------------------------------------------------------------------------------
> > October Webinars: Code for Performance
> > Free Intel webinars can help you accelerate application performance.
> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> > the latest Intel processors and coprocessors. See abstracts and register >
> > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> > ------------------------------------------------------------------------------
> > October Webinars: Code for Performance
> > Free Intel webinars can help you accelerate application performance.
> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> > the latest Intel processors and coprocessors. See abstracts and register >
> > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> <efratio-9.dat.gz><test.py>
|
|
From: Hao Wu <sys...@gm...> - 2013-10-15 16:59:55
|
Hi, I have an issue using latex in my plot file. Below are my information. 1. Operating system: Max OS X version 10.7.5 uname -a Darwin pyramid.phys.northwestern.edu 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 2. matplotlib version: 1.3.0 3. Obtain matplotlib from EPD. Python 2.7.3 | 64-bit | (default, Aug 8 2013, 05:37:06) IPython 0.13.1 -- An enhanced Interactive Python. 4. Here is my matplotlibrc file, I don't have any special customizations 5. The python script that demonstrate the problem can be http://matplotlib.org/examples/pylab_examples/tex_demo.html 6. The debugging output from matplotlib is 7. I did not compile matplotlib myself. Bests, Hao |
|
From: Daniele N. <da...@gr...> - 2013-10-14 23:56:21
|
On 10/10/2013 15:05, Martin MOKREJŠ wrote:
> Hi,
> rendering some of my charts takes almost 50GB of RAM. I believe below is a stracktrace
> of one such situation when it already took 15GB. Would somebody comments on what is
> matplotlib doing at the very moment? Why the recursion?
>
> The charts had to have 262422 data points in a 2D scatter plot, each point has assigned
> its own color. They are in batches so that there are 153 distinct colors but nevertheless,
> I assigned to each data point a color value. There are 153 legend items also (one color
> won't be used).
Hello Martin,
can I ask what is the meaning of plotting a scatter plot with 200
thousands points in it? Either you visualize it on a screen much larger
than mine, or you are not going to be able to distinguish the single
data points. Maybe you should rethink the visualization tool you are using.
Nevertheless, I'm perfectly able to plot a scatter plot with 262422 data
points each with its own color just fine, and the python process
consumes a few hundred Mb of ram (having quite a few other datasets
loaded in memory)::
import numpy as np
import matplotlib.pyplot as plt
n = 262422
x = np.random.rand(n)
y = np.random.rand(n)
c = np.random.rand(n)
f = plt.figure()
a = f.add_subplot(111)
a.scatter(x, y, c=c, s=50)
plt.show()
and a possible solution using exactly 153 different colors, but again, I
don't see how you can distinguish between hundreds different shades of
colors::
n = 262422 #22
ncolors = 153
x = np.random.rand(n)
y = np.random.rand(n)
c = np.random.rand(ncolors)
f = plt.figure()
a = f.add_subplot(111)
for i in xrange(n // ncolors):
a.scatter(x[i*ncolors:(i+1)*ncolors],
y[i*ncolors:(i+1)*ncolors], c=c, s=50)
plt.show()
Unfortunately the code you provide is too contrived to be useful to
understand the root cause of your problem.
Cheers,
Daniele
|
|
From: Martin M. <mmo...@gm...> - 2013-10-14 22:47:08
|
Michael Droettboom wrote: > Sorry to repeat myself, but please reduce this to a short, self contained example, that is absolutely minimal to demonstrate the problem. http://sscce.org/ should help better explain what I'm after. I don't want to find the needle in the haystack here -- there is code in your example that doesn't even run, for example. > > That said, are you really after creating a legend entry for each of the dots? (See below). That just isn't going to work, and I'm not surprised it eats up excessive amounts of memory. I think you want (and can) reduce this to a single scatter call. > > _series = [_ax1.scatter(_x, _y, color=_c, s=objsize, label=_l, hatch='.') for _x, _y, _c, _l in izip(mydata_x, mydata_y, colors, legends)] # returns PathCollection object Are you sure? I think it was concluded on this list that scatter cannot (or does not) take nested lists of lists with series like histogram and piechart do. I cannot find the thread but maybe you are more lucky. I even think that I already opened a bugreport/feature requested in the past for this. But maybe not. Martin > > Mike > > On 10/12/2013 12:57 PM, Martin MOKREJŠ wrote: >> Hi, >> so here is some quick but working example. I added there are 2-3 functions (unused) >> as a bonus, you can easily call them from the main function using same API >> (except the piechart). I hope this shows what I lack in matplotlib - a general API >> so that I could easily switch form scatter plot to piechart or barchart without altering >> much the function arguments. Messing with return objects line2D, PathCollection, Rectangle >> is awkward and I would like to stay away from matplotlib's internals. ;) Some can be sliced, >> so not, you will see in the code. >> >> This eatmem.py will take easily all your memory. Drawing 300000 dots is not feasible >> with 16GB of RAM. While the example is for sure inefficient in many places generating the data >> in python does not eat RAM. That happens afterwards. >> >> I would really like to hear whether matplotlib could be adjusted instead. ;) I already mentioned >> in this thread that it is awkward to pre-create colors before passing all data to a drawing >> function. I think we could all save a lot if matplotlib could dynamically fetch colors >> on the fly from user-created generator, same for legends descriptions. I think my example >> code shows the inefficient approach here. Would I have more time I would randomize a bit >> more the sublist of each series so that the numbers in legends would be more variable >> but that is a cosmetic issue. >> Probably due to my ignorance you will see that figures with legends have different font >> sizes, axes are rescaled and the figure. Of course I wanted to have the drawing same via both >> approaches but failed badly. The files/figures with legends should be just accompanied by the >> legend "table" underneath but the drawing itself should be same. Maybe an issue with DPI settings >> but not only. >> >> I placed some comments in the code, please don't take them in person. ;) Of course >> I am glad for the existing work and am happy to contribute my crap. I am fine if you rewamp >> this ugly code into matplotlib testsuite, provide similar function (the API mentioned above) >> so that I could use your code directly. That would be great. I just tried to show multiple >> issues at once, notably that is why I included those unused functions. You will for sure find >> a way to use them. >> >> Regarding the "unnecessary" del() calls etc., I think I have to use keep some, Ben, because >> the function is not always left soon enough. I could drop some, you are right, but for some >> I don't think so. Matplotlib cannot recycle the memory until me (upstream) deletes the reference >> so ... go and test this lousy code. Now you have a testcase. ;) Same with the gc.collect() calls. >> Actually, the main loop with 10 iteration is there just to show why I always want to clear >> a figure when entering a function and while leaving it as well. It happened too many times that >> I drawed over an old figure, and this was posted also few times on this list by others. That is >> a weird behavior in my opinion. We, users, are just forced to use too low-level functions. >> >> So, have fun eating your memory! :)) >> Martin > > > -- > _ > |\/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _ > | ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | | > > http://www.droettboom.com > -- Martin Mokrejs, Ph.D. Bioinformatics Donovalska 1658 149 00 Prague Czech Republic http://www.iresite.org http://www.iresite.org/~mmokrejs |
|
From: Goyo <goy...@gm...> - 2013-10-14 19:18:51
|
2013/10/14 Mark Lawrence <bre...@ya...>: > On 14/10/2013 13:51, OCuanachain, Oisin (Oisin) wrote: >> Hi, >> >> I am having problems with a script. It runs a number of iterations and >> plots and saves a number of plots on each iteration. After the plots >> have been saved I issue the pyplot.close(‘all’) command so despite many >> plots being created only 4 should be open at any given time which should >> not cause any memory problems. When I run the script however I see the >> RAM usage gradually growing without bound and eventually causing the >> script to crash. Interestingly I have found if I comment out the >> pyplot.ion() and pyplot.ioff() the problem vanishes. So I do have a >> workaround but it would still be good to have this fixed in case I >> forget about it in future and loose another weekend’s work. >> >> My OS is Windows XP Service Pack 3 >> Python 2.6 >> Matplotlib 1.0.1 >> > > Is this actually a matplotlib problem or could it be a Windows problem > as discussed here http://bugs.python.org/issue19246 ? I think this is different. That bug report is not about RAM usage growing without bound but memory allocation failing with plenty of RAM available. Goyo |
|
From: Eric F. <ef...@ha...> - 2013-10-14 18:55:39
|
On 2013/10/14 8:26 AM, OCuanachain, Oisin (Oisin) wrote: > > > Hi Eric, > > If .emf is no longer supported in current versions of matplotlib is > there an alternative SVG-type format I can use ? I use .emf because I > find that it tends to produce the clearest plots independent of how I > re-size them when imported into documents. If memory serves I used to > have a lot of problems with legibility when using raster-type formats > like .png. If I get a chance I will try installing an up-to-date > version of matplotlib and see if I can re-produce the behaviour. > > Oisin. > Oisin, The ps, pdf, and svg vector formats are fully supported. (Postscript inherently lacks support for transparency, though, so pdf and svg are recommended.) Eric |
|
From: OCuanachain, O. (Oisin) <Ois...@ls...> - 2013-10-14 18:26:47
|
-----Bunteachtaireacht----- From: Eric Firing [mailto:ef...@ha...] Sent: 14 October 2013 19:09 To: mat...@li... Subject: Re: [Matplotlib-users] Maidir le: Memory leak when using pyplot.ion() ? On 2013/10/14 7:48 AM, OCuanachain, Oisin (Oisin) wrote: > Hi Mike, > > ion(), ioff() are useful to get immediate feedback when developing a > script, when it is fully debugged I then increase the number of > iterations and leave it running over the weekend. At that point I > could obviously also have removed ion(), ioff() but given that I had > no idea that this was necessary my sim crashed and I lost a weekend's > worth of sim time. Anyway, whether or not ion(),ioff() are needed in > this particular script is really besides the point. If the script, > however unusual, is revealing a bug in matplotlib it should be logged > so that it can hopefully be fixed. > > Oisín Oisín, Certainly we want to find and fix bugs, with memory leaks being high priority. (I don't think we have seen a genuine mpl memory leak for quite a while; I am not aware of any at present.) We are not trying to maintain old mpl versions such as 1.0.1, however. You are using the emf backend, which has been removed. Therefore, unless you can reproduce the problem with mpl 1.3.x or 1.4.x in a SSCCE (http://sscce.org/), it is unlikely that your report will lead to a bug fix. Perhaps it will lead to some useful insight, however. I see someone has suggested that the problem might be in Windows. Another possibility is that it is in TkAgg, which I suspect is your default interactive backend. I dimly recall that there was a time when TkAgg could leak memory, but I don't remember whether that was fixed by 1.0.1 or not. Eric Hi Eric, If .emf is no longer supported in current versions of matplotlib is there an alternative SVG-type format I can use ? I use .emf because I find that it tends to produce the clearest plots independent of how I re-size them when imported into documents. If memory serves I used to have a lot of problems with legibility when using raster-type formats like .png. If I get a chance I will try installing an up-to-date version of matplotlib and see if I can re-produce the behaviour. Oisin. |