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

Showing 12 results of 12

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

Showing 12 results of 12

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