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

Showing 8 results of 8

From: blueone <rar...@gm...> - 2013年05月16日 21:48:05
Thank you very much! This is exactly what i was looking for! 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-gray-area-around-plot-tp41073p41076.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Matthias F. <mat...@gm...> - 2013年05月16日 19:43:32
Hi all,
it seems that I am experiencing the same problem here with imshow (rather
than scatter) and AxesGrid. But calling imshow with aspect=False does not do
the trick for me.
I am trying to have two imshow subplots next to each other and a single
colorbar at the right. The data underlying the imshow's have different x-
and y-ranges but I want the x- and y-axis to have an aspect ratio of 1 (i.e.
each imshow should produce a square). I've tried aspect=False,
aspect='equal', and explicitely setting aspect=2 which should be the correct
value. See the three images below the code example.
I've also tried Grid instead of AxesGrid as suggested but I didn't manage to
achieve good results with the colorbar in that case.
I'd appreciate any help,
Matthias
Here's a more or less minimal code example:
#############################################
import numpy as np
import numpy.random as npr
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
fig = figure(1, figsize=[12,10])
grid = AxesGrid(fig, 111,
 nrows_ncols = (1, 2),
 axes_pad = 0.2,
 share_all = False,
 label_mode = 'L',
 cbar_location = 'right',
 cbar_mode = 'single',
 cbar_pad = 0.2
)
for i in range(2): 
 xmin, xmax = 0., 1.
 ymin, ymax = 0., 0.5
 zmin, zmax = -1., 1.
 
 # generate random data:
 N = 100
 X = xmin + (xmax-xmin)*npr.random((N,)) # x_i in [0, 1]
 Y = ymin + (ymax-ymin)*npr.random((N,)) # y_i in [0, 0.5]
 Z = zmin + (zmax-zmin)*npr.random((N,)) # z_i in [-1, 1]
 
 # generate griddata for imshow plot:
 numspaces = np.sqrt(N)
 xi = linspace(xmin, xmax, numspaces)
 yi = linspace(ymin, ymax, numspaces)
 zi = griddata((X, Y), Z, (xi[None,:], yi[:,None]), method='nearest')
 norm = matplotlib.colors.normalize(vmin=zmin, vmax=zmax)
 
 ax = grid[i]
 im = ax.imshow(zi,
 extent = [xmin,xmax,ymin,ymax], 
 norm = norm, 
 vmin = zmin,
 vmax = zmax, 
 origin = 'lower', 
 aspect = 'equal', # or False, or 'auto', or 2, or ...
 interpolation = 'nearest')
 
 ax.grid(False)
 ax.set_xlabel('x')
 ax.set_ylabel('y')
 
# add a colorbar:
cbar = plt.colorbar(im, cax=grid.cbar_axes[0])
cbar.ax.set_ylabel('color level')
############################################
And here are the three resulting images:
aspect='equal':
<http://matplotlib.1069221.n5.nabble.com/file/n41075/equal.png> 
aspect=False:
<http://matplotlib.1069221.n5.nabble.com/file/n41075/False.png> 
aspect=2.:
<http://matplotlib.1069221.n5.nabble.com/file/n41075/two.png> 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Squashed-axes-with-AxesGrid-tp40699p41075.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2013年05月16日 19:13:49
On Thu, May 16, 2013 at 2:41 PM, blueone <rar...@gm...> wrote:
> Hi,
>
> I am working on my first project involving Matplotlib. I haven't used it
> much, but i'm already impressed by it!
> The project i am working on uses Matplotlib embedded in wxPython. I have
> already embedded it successfully, but there is one thing that i would still
> like to change and that is the gray area around the plot. The background of
> the plot is white and around it there's this thick gray rectangle. Is there
> a way of making it smaller?
>
> Thanks in advance!
>
>
>
You can adjust the margins using subplots_adjust():
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.subplots_adjust
Cheers!
Ben Root
From: blueone <rar...@gm...> - 2013年05月16日 18:41:41
Hi,
I am working on my first project involving Matplotlib. I haven't used it
much, but i'm already impressed by it!
The project i am working on uses Matplotlib embedded in wxPython. I have
already embedded it successfully, but there is one thing that i would still
like to change and that is the gray area around the plot. The background of
the plot is white and around it there's this thick gray rectangle. Is there
a way of making it smaller?
Thanks in advance!
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-gray-area-around-plot-tp41073.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sterling S. <sm...@fu...> - 2013年05月16日 16:45:28
Gregorio,
I experienced a similar issue with trying to change the marker color. 
See below the previous response from JJ for accessing the legend marker or using a proxy artist.
-Sterling
> On Sep 4, 2012, at 5:33PM, Jae-Joon Lee wrote:
> 
> On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith <sm...@fu...> wrote:
>> I still do not get black markers. Furthermore, if you try to make a new legend with the result of leg.get_lines(), you will get lines without markers, which leads me to the conclusion I stated in my previous email (which you did not copy)
>>>> I suspect that this is because the legend marker is drawn separately from the legend line to accommodate the numpoints argument of the legend functions. Then the question is how to access these markers if they are separate from the line2d objects in the legend. I didn't even see them in the children of the legend [legend.get_children()].
> 
> This is correct. To support legend handle like --o-- (i.e., no markers
> at the ends), lines and markers are drawn as a separate artist. You
> may use something like,
> 
> line[0]._legmarker.set_markerfacecolor('black')
> line[1]._legmarker.set_markerfacecolor('black')
> 
> I, personally, recommend you to use a proxy artist.
> 
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
> 
> For example,
> 
> You may do something like
> 
> import pylab
> pylab.plot(pylab.linspace(0,1,100),marker='o',ls='')
> pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-')
> 
> # creates artists for legend purpose only
> l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-')
> l2, = pylab.plot(pylab.linspace(0,1,100), 'ko')
> # remove them from the axes.
> l1.remove()
> l2.remove()
> 
> leg=pylab.legend([l1, l2], ["Test 1", "Test 2"], loc='best')
> 
> Regards,
> 
> -JJ
On May 16, 2013, at 7:25AM, Gregorio Bastardo wrote:
> Hi,
> 
> I've recently come accross an issue when working on an interactive
> marker toggling callback. The problem is illustrated below:
> 
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> line, = ax.plot(range(10), range(10))
> # uncomment next line to reproduce bug
> # line.set_marker('d')
> legend = ax.legend([line], ['foo'])
> legend_line, = legend.get_lines()
> fig.show()
> raw_input('press enter to clear marker')
> line.set_marker('')
> legend_line.set_marker('')
> fig.canvas.draw()
> raw_input('press enter to set marker')
> line.set_marker('d')
> legend_line.set_marker('d')
> fig.canvas.draw()
> raw_input('press enter to exit')
> 
> So when I add a line object to the legend *without marker*, the update
> works fine both on data and legend line, but *with marker* it does not
> refresh the legend line. I consider it as a bug, please tell me if I'm
> doing something wrong.
> 
> python 2.7.4 win32
> matplotlib 1.2.1
> 
> Thanks,
> Gregorio
> 
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Gregorio B. <gre...@gm...> - 2013年05月16日 14:25:54
Hi,
I've recently come accross an issue when working on an interactive
marker toggling callback. The problem is illustrated below:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot(range(10), range(10))
# uncomment next line to reproduce bug
# line.set_marker('d')
legend = ax.legend([line], ['foo'])
legend_line, = legend.get_lines()
fig.show()
raw_input('press enter to clear marker')
line.set_marker('')
legend_line.set_marker('')
fig.canvas.draw()
raw_input('press enter to set marker')
line.set_marker('d')
legend_line.set_marker('d')
fig.canvas.draw()
raw_input('press enter to exit')
So when I add a line object to the legend *without marker*, the update
works fine both on data and legend line, but *with marker* it does not
refresh the legend line. I consider it as a bug, please tell me if I'm
doing something wrong.
python 2.7.4 win32
matplotlib 1.2.1
Thanks,
Gregorio
From: Michael D. <md...@st...> - 2013年05月16日 01:17:31
I've created an issue in the tracker for this:
https://github.com/matplotlib/matplotlib/issues/2016
Mike
On 05/15/2013 06:26 PM, Christoph Gohlke wrote:
> On 5/15/2013 1:55 PM, Ojala Janne wrote:
>>
>>>> Which backend are you using? I can't reproduce. Does
>>
>>>> https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py 
>>>>
>> <https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py> 
>>
>>
>>>> work for you?
>>
>> The bug only happens if I try to save the figure as EPS. So I suppose 
>> that
>> then means its a cairo back end (happens also if I force cairo). So that
>> means
>> as written the code works fine but if i try to make publishable quality
>> output
>> by saving as EPS (a raster image is not suitable), it crashes.
>>
>> But it again works if I add any character thats so weird that ist on a n
>> extended
>> unicode block then all characters seem to be handled correctly. Even
>> the ones
>> that previously crashed.
>>
>
> I can reproduce the crash on Python 2.7, 32 and 64 bit. Python 2.6 and 
> 3.3 appear to work. The call stack is attached. The crash is in 
> ttfont_add_glyph_dependencies() at 
> <https://github.com/matplotlib/matplotlib/blob/v1.2.x/ttconv/pprdrv_tt2.cpp#L703>
>
> Christoph
>
>
>
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: gaspra <ye...@gm...> - 2013年05月16日 00:01:47
Paul Hobson-2 wrote
> This works fine on my system:
> In [3]: np.version.full_version
> 
> Out[3]: '1.7.1'
> 
> 
> In [5]: matplotlib.__version__
> 
> Out[5]: '1.2.1'
> 
> 
> Not sure what the issue could be.
> 
> -p
Hi Paul,
Thanks for the reply. I am using np version 1.7.1 and matplotlib version
1.3.x. In fact I have the same problem with matplotlib version 1.2.1. Could
it be the problem with Mac OS (mountain lion 10.8.3)?
Yuan
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41065.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing 8 results of 8

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /