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: Moore, E. (NIH/N. [F] <eri...@ni...> - 2014-10-27 21:12:21
|
Hi, Is it ever possible to edit the text produced by matplotlib when saving to ps, eps or pdf? No matter the combination of setting I try the text always imports as outlines rather than text. If it makes a difference, I'm using CorelDraw. Does this work for anyone? Eric |
|
From: Benjamin R. <ben...@ou...> - 2014-10-27 18:07:24
|
Which version of matplotlib are you running? I could have sworn this was fixed awhile ago. If I understand the problem correctly, essentially, the autoscalling was clipping empty patches out. Ben Root On Sun, Oct 26, 2014 at 2:57 AM, Matthew Brett <mat...@gm...> wrote: > Hi, > > I just noticed that this: > > >>> x = np.arange(10) > >>> y = np.zeros(10) > >>> y[5] = 1 > >>> plt.bar(x, y) > > Will generate a big box for x = 5 with x 0:5 and 6: stripped, whereas this: > > >>> y += 0.000001 > >>> plt.bar(x, y) > > Will generate a bar plot going from x = 0 to 9 with a bar at 5 as I > was expecting. > > If I make a zeros vector with two discontiguous 1 values, then I also > get the full x range, with two spikes. > > >>> y = np.zeros(10) > >>> y[2] = 1 > >>> y[5] = 1 > >>> plt.bar(x, y) > > Is this expected? It certainly surprised me... > > Matthew > > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Andy B. <an...@in...> - 2014-10-27 14:36:03
|
Hi, I'm using MPL to implement a new plotter for a project has so far been using a custom-written LaTeX+pstricks script. Despite being slow and a bit hacky, the output is really quite nice and I want to try and emulate it as closely as possible via MPL; for example: https://users.hepforge.org/~buckley/atlas-py8-shower-e/ATLAS_2012_I1094568/d03-x02-y01.pdf I more or less have this working, but would really like to be able to use the "old-style figures" (OSF) numerals with variable baseline (aka lower-case or text figures cf. http://en.wikipedia.org/wiki/Text_figures), which give those plots quite a bit of their character. Probably this will anyway be possible only with the TeX or PGF backend to MPL, but what would be the best way to enable OSF figures from MPL? If I correctly understand the backend, the rc params font.family & e.g. font.serif are passed to the LaTeX fontspec package -- and in the fontspec documentation http://mirror.utexas.edu/ctan/macros/latex/contrib/fontspec/fontspec.pdf it seems that passing the Numbers=(OldStyle) option to the \fontspec command (or as the arg to \addfontfeature) would be the fontspec version of, for example, \usepackage[osf]{mathpazo}. Is there a way to pass options like this to fontspec? In general this would seem a useful thing to be able to do, since fontspec controls far more than OSFs, but I couldn't find a discussion of it in the docs. Hope you can help; thanks! Andy -- Dr Andy Buckley, Royal Society University Research Fellow Particle Physics Expt Group, University of Glasgow / PH Dept, CERN |
|
From: Ian T. <ian...@gm...> - 2014-10-26 16:31:14
|
On 26 October 2014 00:18, Hartmut Kaiser <har...@gm...> wrote:
> At this point we assume, that polys[0] is a linear ring to be interpreted
> as
> a polygon exterior and polys[1:] are the corresponding interiors for
> polys[0].
>
> Here are our questions:
>
> Is this assumption correct?
> Is there any detailed documentation describing the structure of the
> returned
> geometries?
> Are the linear rings supposed to be correctly oriented (area > 0 for
> exteriors and area < 0 for the interiors)?
>
Hello Hartmut,
In brief, the answers are no, no and yes.
In more detail, assuming polys is not empty then it will contain one or
more polygon exteriors and zero or more interiors, and they can be in any
order. Here is a simple example where polys[0] is an interior and polys[1]
an exterior:
x = [0, 0, 1, 1, 0.5]
y = [0, 1, 0, 1, 0.5]
z = [0.5, 0.5, 0.5, 0.5, 0]
triang = tri.Triangulation(x, y)
contour = plt.tricontourf(triang, z, levels=[0.2, 0.4])
The returned geometries are purposefully not documented. They are an
'implementation detail' and not considered part of the public interface.
and as such they could change at any time and hence should not be relied
upon. Of course you can choose to access them if you wish, as I do myself
sometimes, but we make no promises about what the order of the polygons is,
or that it won't change tomorrow.
In reality the order of the polygons is chosen to be something that is easy
for both the contour generation routines to create and for the various
backends to render. If you were to look at the output generated by
contourf, you will see that it is organised differently from that produced
by tricontourf and is more like you would like it to be, i.e. one or more
groups of an exterior polygon followed by zero or more interiors. This is
historical as the contourf code dates from before all of the backends were
able to render arbitrary groups of exterior and interior polygons, and so
the contourf code has to calculate the order for the backends. When the
tricontourf code was written the backends were all able to calculate the
exterior/interior containment themselves, so there was no need for
tricontourf to do it as well.
Ian
|
|
From: Matthew B. <mat...@gm...> - 2014-10-26 06:57:42
|
Hi, I just noticed that this: >>> x = np.arange(10) >>> y = np.zeros(10) >>> y[5] = 1 >>> plt.bar(x, y) Will generate a big box for x = 5 with x 0:5 and 6: stripped, whereas this: >>> y += 0.000001 >>> plt.bar(x, y) Will generate a bar plot going from x = 0 to 9 with a bar at 5 as I was expecting. If I make a zeros vector with two discontiguous 1 values, then I also get the full x range, with two spikes. >>> y = np.zeros(10) >>> y[2] = 1 >>> y[5] = 1 >>> plt.bar(x, y) Is this expected? It certainly surprised me... Matthew |
|
From: Thomas C. <tca...@gm...> - 2014-10-26 03:47:13
|
Hot on the tails of v1.4.1, we have a v1.4.2 due to an error in the boxplot api in pyplot.py The only changes between 1.4.1 and 1.4.2 are: - corrected boxplot in pyplot.py - added extra paths to default search paths for freetype Tom -- Thomas Caswell tca...@gm... |
|
From: Hartmut K. <har...@gm...> - 2014-10-25 23:18:13
|
All,
We try to generate contour polygons from an unstructured triangular grid
stored in a netcdf file:
import netCDF4
import matplotlib.tri as tri
# read data
var = netCDF4.Dataset('filename.cdf').variables
x = var['x'][:]
y = var['y'][:]
elems = var['element'][:,:]-1
data = var['attrname'][:]
# create triangulation
triang = tri.Triangulation(x, y, triangles=elems)
# generate contour polygons
levels = numpy.linspace(0, maxlevel, num=numlevels)
contour = plt.tricontourf(triang, data, levels=levels)
# extract geometries
for coll in contour.collections:
# handle all geometries for one level
for p in coll.get_paths():
polys = p.to_polygons()
...
At this point we assume, that polys[0] is a linear ring to be interpreted as
a polygon exterior and polys[1:] are the corresponding interiors for
polys[0].
Here are our questions:
Is this assumption correct?
Is there any detailed documentation describing the structure of the returned
geometries?
Are the linear rings supposed to be correctly oriented (area > 0 for
exteriors and area < 0 for the interiors)?
Thanks!
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu
|
|
From: Fabrice C. <kap...@ya...> - 2014-10-24 21:22:11
|
Dear all, I have read the 3 Sankey diagram examples. The first example shows arrow shapes with the default value for angle while the second example shows arrows with180 degree angles which make them look like a flat line. Does anyone know if it would be possible to mix the two styles inside a single diagram ? I would like some flows to be represented by the regular arrows and some other flows to be represented by the 180 degree angle. Best regards, Fabrice |
|
From: Tommy C. <tom...@gm...> - 2014-10-24 20:31:53
|
Felipe, thanks for the links! I do realize it would be impossible to leave out non-African mainland when using bluemarble(). I could color Europe, Madagascar, Middle East white on a map with filled continents, but I would have to be accurate at the Israel/Egypt, Djibouti/Yemen and Spain/Morocco borders. Not the solution I was looking to implement. Using Cartopy and a shapefile of Africa seems to be a very good solution. I'll look into this. Thanks! On Fri, Oct 24, 2014 at 12:25 PM, Filipe Pires Alvarenga Fernandes <oc...@gm...> wrote: > Hi Tommy, there is not easy way to do it with matplolib+basemap. Also, you > will find it extra hard because the image you are plotting (blue marble) is > raster that is cut in lon, lat bounding box. Therefore, unless you create a > mask around what to plot and what not to plot, it will show everything that > is inside that box. > > One alternative is cartopy. With cartopy you have easy access to Natural > Earth features. That way you can find the proper feature, that represents > just the African continent, and plot it: > > http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html > > https://ocefpaf.github.io/python4oceanographers/blog/2013/09/30/natural_earth/ > > Good luck! > > -Filipe > > On Fri, Oct 24, 2014 at 7:21 AM, Tommy Carstensen > <tom...@gm...> wrote: >> >> Does anyone know, whether a continent can be left out when plotting >> with matplotlib basemap? For example I wish to hide Europe (and >> Madagascar) on this plot: >> >> http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Tommy C. <tom...@gm...> - 2014-10-24 20:23:28
|
Thanks for feedback Thomas and Sterling. Here is the ugly solution I
ended up with:
# plot a marker with a blank label
map.plot(x, y, 'o', markersize=markersize, markerfacecolor=color, label="")
# specify a coordinate outside the map region (Africa)
x,y = map(-60, -60)
# use a fixed markersize for coordinates outside the map region and
use a non-blank label
map.plot(x, y, 'o', markersize=10, markerfacecolor=color, label=label)
I should have used proxy artists as suggested by Sterling. Here is an example:
http://matplotlib.org/users/legend_guide.html#proxy-legend-handles
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
red_patch = mpatches.Patch(color='red', label='The red data')
plt.legend(handles=[red_patch])
plt.show()
On Fri, Oct 24, 2014 at 7:36 PM, Sterling Smith <sm...@fu...> wrote:
> Your solution is about as good as "proxy artists" in legends, which would be the official method. (Google "proxy artist matplotlib".)
>
> It may be relevant that you can access the marker of the legend entries with the _marker attribute of the handles. Search the mailing list archives for this one.
>
> -Sterling
>
> On Oct 23, 2014, at 8:05PM, Tommy Carstensen wrote:
>
>> Is there a way to have all markers in the legend box have the same size?
>> www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg
>>
>> I came up with a solution by plotting a marker outside the latitude
>> and longitude range, but that's not a very good solution.
>>
>> Thanks for your time.
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Christian A. <ia...@gm...> - 2014-10-24 19:59:59
|
Hi Ben, Yes, indeed. I'm referring to a choropleth. :) Thanks, Christian On Oct 24, 2014 8:23 PM, "Benjamin Root" <ben...@ou...> wrote: > Do you mean choropleth? http://en.wikipedia.org/wiki/Choropleth_map > > On Fri, Oct 24, 2014 at 1:18 PM, ianalis <ia...@gm...> wrote: > >> I have been creating chloropleth maps in Python by adding patches and/or >> polygons in a matplotlib Axes but I'm looking for something easier to use. >> >> Ideally, the interface should be similar to how contour maps or >> pseudocolor >> plots are created where, at the minimum, only one call to a function is >> needed to create these plots from data. Colors are automatically assigned >> and normalized based on values. A colorbar can then be added by calling >> another function. >> >> So far, the closest package seems to be geopandas. Is there an another >> package that is nearer to what I want? That is, is there a package that >> can >> make a (basic) chloropleth of values stored as a dictionary, numpy array >> or >> pandas dataframe in one call? >> >> I'm willing to contribute code and help develop the chloropleth capability >> of a package since I currently end up creating my own function and >> manipulating Axes internals just to create a chloropleth. >> >> >> >> -- >> View this message in context: >> http://matplotlib.1069221.n5.nabble.com/Easiest-way-to-create-a-chloropleth-in-Python-tp44195.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > |
|
From: Benjamin R. <ben...@ou...> - 2014-10-24 19:23:47
|
Do you mean choropleth? http://en.wikipedia.org/wiki/Choropleth_map On Fri, Oct 24, 2014 at 1:18 PM, ianalis <ia...@gm...> wrote: > I have been creating chloropleth maps in Python by adding patches and/or > polygons in a matplotlib Axes but I'm looking for something easier to use. > > Ideally, the interface should be similar to how contour maps or pseudocolor > plots are created where, at the minimum, only one call to a function is > needed to create these plots from data. Colors are automatically assigned > and normalized based on values. A colorbar can then be added by calling > another function. > > So far, the closest package seems to be geopandas. Is there an another > package that is nearer to what I want? That is, is there a package that can > make a (basic) chloropleth of values stored as a dictionary, numpy array or > pandas dataframe in one call? > > I'm willing to contribute code and help develop the chloropleth capability > of a package since I currently end up creating my own function and > manipulating Axes internals just to create a chloropleth. > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Easiest-way-to-create-a-chloropleth-in-Python-tp44195.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Sterling S. <sm...@fu...> - 2014-10-24 18:36:33
|
Your solution is about as good as "proxy artists" in legends, which would be the official method. (Google "proxy artist matplotlib".) It may be relevant that you can access the marker of the legend entries with the _marker attribute of the handles. Search the mailing list archives for this one. -Sterling On Oct 23, 2014, at 8:05PM, Tommy Carstensen wrote: > Is there a way to have all markers in the legend box have the same size? > www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg > > I came up with a solution by plotting a marker outside the latitude > and longitude range, but that's not a very good solution. > > Thanks for your time. > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: ianalis <ia...@gm...> - 2014-10-24 17:18:34
|
I have been creating chloropleth maps in Python by adding patches and/or polygons in a matplotlib Axes but I'm looking for something easier to use. Ideally, the interface should be similar to how contour maps or pseudocolor plots are created where, at the minimum, only one call to a function is needed to create these plots from data. Colors are automatically assigned and normalized based on values. A colorbar can then be added by calling another function. So far, the closest package seems to be geopandas. Is there an another package that is nearer to what I want? That is, is there a package that can make a (basic) chloropleth of values stored as a dictionary, numpy array or pandas dataframe in one call? I'm willing to contribute code and help develop the chloropleth capability of a package since I currently end up creating my own function and manipulating Axes internals just to create a chloropleth. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Easiest-way-to-create-a-chloropleth-in-Python-tp44195.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Filipe P. A. F. <oc...@gm...> - 2014-10-24 11:26:23
|
Hi Tommy, there is not easy way to do it with matplolib+basemap. Also, you will find it extra hard because the image you are plotting (blue marble) is raster that is cut in lon, lat bounding box. Therefore, unless you create a mask around what to plot and what not to plot, it will show everything that is inside that box. One alternative is cartopy. With cartopy you have easy access to Natural Earth features. That way you can find the proper feature, that represents just the African continent, and plot it: http://scitools.org.uk/cartopy/docs/latest/examples/hurricane_katrina.html https://ocefpaf.github.io/python4oceanographers/blog/2013/09/30/natural_earth/ Good luck! -Filipe On Fri, Oct 24, 2014 at 7:21 AM, Tommy Carstensen < tom...@gm...> wrote: > Does anyone know, whether a continent can be left out when plotting > with matplotlib basemap? For example I wish to hide Europe (and > Madagascar) on this plot: > > http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg |
|
From: Tommy C. <tom...@gm...> - 2014-10-24 10:22:23
|
Does anyone know, whether a continent can be left out when plotting with matplotlib basemap? For example I wish to hide Europe (and Madagascar) on this plot: http://www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg On Sat, Oct 18, 2014 at 7:57 AM, Tommy Carstensen <tom...@gm...> wrote: > Is it possible to tell matplotlib to only plot the African continent? > http://tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg > > I can do this in gnuplot, but I can't figure out how to do it with > matplotlib/basemap. > > Thanks, > Tommy |
|
From: Scott L. <sl...@sp...> - 2014-10-24 05:55:06
|
You might try unchecking "Anti-alias text and line art" in the PDF panel in Preview's Preferences dialog to see if that helps. Best regards, Scott On Oct 23, 2014, at 8:49 PM, Frédéric Vogt <fre...@an...> wrote: > Interesting development of the issue described below, shared with the list for legacy purposes. > > As it turns out, which PDF viewer one uses does matter when it comes to printing (on paper) matplotlib figures containing 'imshow' plots and saved as .pdf. The problem I had was the result of printing the matplotlib figure via Mac OSX's "Preview". If I print the same figure via Acrobat Reader, then the grid in both panel look identical, the panel edges are sharp and crisp, etc ... > > This most certainly points out towards a difference deep inside Preview and Acrobat - haven't tried other PDF viewers. > > For reference, I am on Mac OS 10.6, used Preview 5.0.3 and Acrobat reader 10.1.12. > > Cheers, > Fréd > > > On 23/10/2014, at 10:07 PM, Frédéric Vogt wrote: > >> Hi everyone, >> >> Using 'imshow' to plot a few arrays (arranged with gridspec) that I then export directly to a .pdf file using savefig, I noticed that when I print the .pdf file (i.e. on real paper) some of the subplots are blurry. >> >> To clarify: >> - in all my figures, there is always 1 subplot very sharp and crisp, and all the others are slightly blurry, >> - the effect is not visible on the screen at any zoom level, >> - the effect is very slight, and hardly noticeable ... until you plot a fine dotted grid - and then, it becomes evident (the grid points pop out a LOT more in the sharp plot), >> - the entire 'sub-image' is blurred (axes, on-image text, grids, etc...) but the axis labels and tick labels are fine. >> >> This effect is hard to describe, so I placed an example here: http://www.mso.anu.edu.au/~fvogt/mpl_tmp/ >> You can compare the original pdf (straight out of Python) and the 'scanned-printed' version. The scan is not of the highest quality, but you can definitely see that the grid on the left is fainter - and if you zoom in, the figure's edges are also less sharp. >> >> I tried (and failed) to find info on the web so far (I'm still searching). In the meantime, has anyone seen this effect before ? Is this a documented bug/feature ? >> >> I suspect that it may be related to how subplots (containing distinct images) are exported to .pdf, but it is a long way beyond my current knowledge of the savefig function. Note that playing with the dpi setting (I went up to 1200) doesn't help (I can see the improvement on the images themselves but the print blurriness remains). And just in case you wonder, the print bluriness also remains whether I print the .pdf straight out of Python or include it inside a Latex document first. >> >> Any ideas on how to fix/go around this ? >> >> Cheers, >> Fréd >> >> P.S.: The effect is not present if I export my figures in png. But for quality purposes, I'd much rather try to avoid going through png if I can ... >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Tommy C. <tom...@gm...> - 2014-10-24 03:06:21
|
Is there a way to have all markers in the legend box have the same size? www.tommycarstensen.com/python3_matplotlib_basemap_merc_bluemarbleTrue_scaledTrue_1000GTrue_hresolution.jpg I came up with a solution by plotting a marker outside the latitude and longitude range, but that's not a very good solution. Thanks for your time. |
|
From: Frédéric V. <fre...@an...> - 2014-10-24 00:50:14
|
Interesting development of the issue described below, shared with the list for legacy purposes. As it turns out, which PDF viewer one uses does matter when it comes to printing (on paper) matplotlib figures containing 'imshow' plots and saved as .pdf. The problem I had was the result of printing the matplotlib figure via Mac OSX's "Preview". If I print the same figure via Acrobat Reader, then the grid in both panel look identical, the panel edges are sharp and crisp, etc ... This most certainly points out towards a difference deep inside Preview and Acrobat - haven't tried other PDF viewers. For reference, I am on Mac OS 10.6, used Preview 5.0.3 and Acrobat reader 10.1.12. Cheers, Fréd On 23/10/2014, at 10:07 PM, Frédéric Vogt wrote: > Hi everyone, > > Using 'imshow' to plot a few arrays (arranged with gridspec) that I then export directly to a .pdf file using savefig, I noticed that when I print the .pdf file (i.e. on real paper) some of the subplots are blurry. > > To clarify: > - in all my figures, there is always 1 subplot very sharp and crisp, and all the others are slightly blurry, > - the effect is not visible on the screen at any zoom level, > - the effect is very slight, and hardly noticeable ... until you plot a fine dotted grid - and then, it becomes evident (the grid points pop out a LOT more in the sharp plot), > - the entire 'sub-image' is blurred (axes, on-image text, grids, etc...) but the axis labels and tick labels are fine. > > This effect is hard to describe, so I placed an example here: http://www.mso.anu.edu.au/~fvogt/mpl_tmp/ > You can compare the original pdf (straight out of Python) and the 'scanned-printed' version. The scan is not of the highest quality, but you can definitely see that the grid on the left is fainter - and if you zoom in, the figure's edges are also less sharp. > > I tried (and failed) to find info on the web so far (I'm still searching). In the meantime, has anyone seen this effect before ? Is this a documented bug/feature ? > > I suspect that it may be related to how subplots (containing distinct images) are exported to .pdf, but it is a long way beyond my current knowledge of the savefig function. Note that playing with the dpi setting (I went up to 1200) doesn't help (I can see the improvement on the images themselves but the print blurriness remains). And just in case you wonder, the print bluriness also remains whether I print the .pdf straight out of Python or include it inside a Latex document first. > > Any ideas on how to fix/go around this ? > > Cheers, > Fréd > > P.S.: The effect is not present if I export my figures in png. But for quality purposes, I'd much rather try to avoid going through png if I can ... > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Frédéric V. <fre...@an...> - 2014-10-23 11:07:36
|
Hi everyone, Using 'imshow' to plot a few arrays (arranged with gridspec) that I then export directly to a .pdf file using savefig, I noticed that when I print the .pdf file (i.e. on real paper) some of the subplots are blurry. To clarify: - in all my figures, there is always 1 subplot very sharp and crisp, and all the others are slightly blurry, - the effect is not visible on the screen at any zoom level, - the effect is very slight, and hardly noticeable ... until you plot a fine dotted grid - and then, it becomes evident (the grid points pop out a LOT more in the sharp plot), - the entire 'sub-image' is blurred (axes, on-image text, grids, etc...) but the axis labels and tick labels are fine. This effect is hard to describe, so I placed an example here: http://www.mso.anu.edu.au/~fvogt/mpl_tmp/ You can compare the original pdf (straight out of Python) and the 'scanned-printed' version. The scan is not of the highest quality, but you can definitely see that the grid on the left is fainter - and if you zoom in, the figure's edges are also less sharp. I tried (and failed) to find info on the web so far (I'm still searching). In the meantime, has anyone seen this effect before ? Is this a documented bug/feature ? I suspect that it may be related to how subplots (containing distinct images) are exported to .pdf, but it is a long way beyond my current knowledge of the savefig function. Note that playing with the dpi setting (I went up to 1200) doesn't help (I can see the improvement on the images themselves but the print blurriness remains). And just in case you wonder, the print bluriness also remains whether I print the .pdf straight out of Python or include it inside a Latex document first. Any ideas on how to fix/go around this ? Cheers, Fréd P.S.: The effect is not present if I export my figures in png. But for quality purposes, I'd much rather try to avoid going through png if I can ... |
|
From: Russell O. <ro...@uw...> - 2014-10-22 18:26:57
|
I'm seeing a memory leak with calls to subplot.clear() and canvas.draw()
on MacOS. The same code shows no leakage on unix.
Here is a simple script that demonstrates the problem.
#!/usr/bin/env python
from __future__ import division
"""Demonstrate a memory leak in matplotlib on MacOS with TkAgg
Variants:
- Comment out subplot.clear(): this reduces the leak by about 4/5
- Comment out canvas.draw(): this reduces the leak by about 1/5
- Comment out both: there should be essentially no leakage
The leak rate seems to be affected by the update rate
(larger update interval causes lower leakage),
which suggests it's not a simple "x amount of leakage per call".
"""
import resource
import time
import Tkinter
import matplotlib
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
class MemoryLeaker(Tkinter.Frame):
"""Demonstrate a memory leak in matplotlib
"""
def __init__(self, master, updateInterval=0.1, updatesPerReport=25):
"""Construct a MemoryLeaker
Inputs:
- master: master widget
- updateInterval: interval at which subplot.clear and
canvas.draw are called
- updatesPerReport: number of updates between memory reports
"""
Tkinter.Frame.__init__(self, master)
self._updateInterval = float(updateInterval)
self._updatesPerReport = int(updatesPerReport)
self.figure = matplotlib.figure.Figure(figsize=(8, 2),
frameon=True)
self.canvas = FigureCanvasTkAgg(self.figure, self)
self.canvas.get_tk_widget().grid(row=0, column=0, sticky="news")
self.subplot = self.figure.add_subplot(1, 1, 1)
print "time max RSS leak rate"
print "(sec) (kb) (kb/sec)"
self._prevTime = time.time()
self._prevMem = float("nan")
self._reportCount = 0
self.updatePlot()
def updatePlot(self):
"""Update the plot; calls itself at the update interval
"""
if self._reportCount == 0:
self.reportMem()
self._reportCount = (self._reportCount + 1) %
self._updatesPerReport
self.subplot.clear()
self.canvas.draw()
self.after(int(self._updateInterval * 1000), self.updatePlot)
def reportMem(self):
currTime = time.time()
dTime = currTime - self._prevTime
res = resource.getrusage(resource.RUSAGE_SELF)
currMem = res.ru_maxrss / 1024 # maximum resident set size
utilized (in kb)
leakRate = (currMem - self._prevMem) / dTime
self._prevTime = currTime
self._prevMem = currMem
print "%6.1f %6d %6.1f" % (dTime, currMem, leakRate)
if __name__ == "__main__":
root = Tkinter.Tk()
wdg = MemoryLeaker(root, updateInterval=0.1, updatesPerReport=25)
wdg.pack(expand=True, fill="both")
root.mainloop()
P.S. my current setup is:
- MacOS 10.9
- python.org python 2.7.8
- matploblib 1.3.1
- a pre-release of Tcl/Tk 8.5.17
but I've seen this on many earlier versions, as well
I have not tried it with matplotlib 1.4.1 yet (due to problems packaging
that with py2app).
|
|
From: Tommy C. <tom...@gm...> - 2014-10-22 16:37:53
|
I was able to solve my two problems by doing label="" and numpoints=1. Thank you very much for your help. I found my solution here: http://stackoverflow.com/questions/19385639/duplicate-items-in-legend-in-matplotlib There is also another cleaner solution here: http://stackoverflow.com/questions/13588920/stop-matplotlib-repeating-labels-in-legend import matplotlib matplotlib.use('Agg') from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt map = Basemap() map.plot(label="") plt.legend(numpoints=1) On Mon, Oct 20, 2014 at 8:11 AM, Benjamin Root <ben...@ou...> wrote: > Legends entries are blindly constructed. Each plotting call that has a > legend keyword argument will produce a legend entry if you are automatically > building the legend. You can pass a label value of "__nolabel__" to prevent > an entry if you know you are about to do something that would duplicate the > entries. Another approach is to manually collect unique artists and manually > build the legend (I think there is an example of that in the gallary). > > As for configuring the legend, there are a bunch of parameters that can be > set for sizing the font. I think the sizing of the marker is determined by > their size in the plot, though. > > Cheers! > Ben Root > > > On Mon, Oct 20, 2014 at 10:46 AM, Hearne, Mike <mh...@us...> wrote: >> >> For your first question: Use the legend "numpoints" keyword. I think >> if you set it to 1, it should solve that problem. >> >> For your second question, I'm not sure, but I'll bet if you poke >> around in the Legend object returned by the function, you'll find >> something. >> >> On Mon, Oct 20, 2014 at 8:04 AM, Tommy Carstensen >> <tom...@gm...> wrote: >> > How does one avoid duplicate legends? >> > >> > www.tommycarstensen.com/python2_matplotlib_basemap_merc_bluemarble_hresolution.jpg >> > >> > Can I make the legend size smaller than the marker size? >> > >> > >> > ------------------------------------------------------------------------------ >> > Comprehensive Server Monitoring with Site24x7. >> > Monitor 10 servers for $9/Month. >> > Get alerted through email, SMS, voice calls or mobile push >> > notifications. >> > Take corrective actions from your mobile device. >> > http://p.sf.net/sfu/Zoho >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Paul H. <pmh...@gm...> - 2014-10-22 16:01:32
|
I seem to recall that the MaxNLocator and some carefully chosen axes limits suffices for me in the past. On Tue, Oct 21, 2014 at 11:44 AM, Adam Hughes <hug...@gm...> wrote: > I wrote a program that draws grids manually on mpl plots a while back. If > you can't find a solution can you write back here and I'll try to get that > dusted off? > On Oct 21, 2014 2:39 PM, "Benjamin Root" <ben...@ou...> wrote: > >> Well, the first part is easy... it is called twinx(). If you look up axis >> twinning in the documentation, you will find a lot of examples of this. >> >> As for the grids part... that would be tricky. I would first just see if >> matplotlib "just does the right thing". Doubtful, but who knows? Then I >> would likely go the route of lining up the major ticks on both axes so that >> the grid lines for one axes match up with the ticks for the other. >> >> Let us know what you find out. Maybe it might be a useful feature to add >> for twinning. >> >> Cheers! >> Ben Root >> >> >> On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndb...@gm...> wrote: >> >>> I need to overlay 2 different plots. They will share an x-axis, but >>> will have 2 >>> different y axis with 2 different sets of units. I want one y-axis on >>> left and >>> one on right. >>> >>> But to make it harder, I want a grid. That means, there are either 2 >>> different >>> grids, which is ugly, or one plot has to be scaled vertically so that >>> the same y >>> grid can be shared between them. >>> >>> Anyone know how to do this? >>> >>> -- >>> -- Those who don't understand recursion are doomed to repeat it >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Comprehensive Server Monitoring with Site24x7. >>> Monitor 10 servers for $9/Month. >>> Get alerted through email, SMS, voice calls or mobile push notifications. >>> Take corrective actions from your mobile device. >>> http://p.sf.net/sfu/Zoho >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Adam H. <hug...@gm...> - 2014-10-21 18:44:32
|
I wrote a program that draws grids manually on mpl plots a while back. If you can't find a solution can you write back here and I'll try to get that dusted off? On Oct 21, 2014 2:39 PM, "Benjamin Root" <ben...@ou...> wrote: > Well, the first part is easy... it is called twinx(). If you look up axis > twinning in the documentation, you will find a lot of examples of this. > > As for the grids part... that would be tricky. I would first just see if > matplotlib "just does the right thing". Doubtful, but who knows? Then I > would likely go the route of lining up the major ticks on both axes so that > the grid lines for one axes match up with the ticks for the other. > > Let us know what you find out. Maybe it might be a useful feature to add > for twinning. > > Cheers! > Ben Root > > > On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndb...@gm...> wrote: > >> I need to overlay 2 different plots. They will share an x-axis, but will >> have 2 >> different y axis with 2 different sets of units. I want one y-axis on >> left and >> one on right. >> >> But to make it harder, I want a grid. That means, there are either 2 >> different >> grids, which is ugly, or one plot has to be scaled vertically so that the >> same y >> grid can be shared between them. >> >> Anyone know how to do this? >> >> -- >> -- Those who don't understand recursion are doomed to repeat it >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Benjamin R. <ben...@ou...> - 2014-10-21 18:37:33
|
Well, the first part is easy... it is called twinx(). If you look up axis twinning in the documentation, you will find a lot of examples of this. As for the grids part... that would be tricky. I would first just see if matplotlib "just does the right thing". Doubtful, but who knows? Then I would likely go the route of lining up the major ticks on both axes so that the grid lines for one axes match up with the ticks for the other. Let us know what you find out. Maybe it might be a useful feature to add for twinning. Cheers! Ben Root On Tue, Oct 21, 2014 at 2:29 PM, Neal Becker <ndb...@gm...> wrote: > I need to overlay 2 different plots. They will share an x-axis, but will > have 2 > different y axis with 2 different sets of units. I want one y-axis on > left and > one on right. > > But to make it harder, I want a grid. That means, there are either 2 > different > grids, which is ugly, or one plot has to be scaled vertically so that the > same y > grid can be shared between them. > > Anyone know how to do this? > > -- > -- Those who don't understand recursion are doomed to repeat it > > > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |