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



Showing results of 408

<< < 1 .. 13 14 15 16 17 > >> (Page 15 of 17)
From: C M <cmp...@gm...> - 2012年02月06日 14:33:39
On Mon, Feb 6, 2012 at 9:23 AM, David Craig <dcd...@gm...> wrote:
> Hi, I have a plot and the xaxis shows number of seconds after a start
> point. I would like to convert them to days anyone know how to do this.
> I have looked at the documentation but cant find what I need.
>
Couldn't you divide your data points by the conversion (86400) before
plotting? E.g., 432,000 seconds then becomes 5 days.
From: David C. <dcd...@gm...> - 2012年02月06日 14:24:08
Hi, I have a plot and the xaxis shows number of seconds after a start 
point. I would like to convert them to days anyone know how to do this. 
I have looked at the documentation but cant find what I need.
From: Jonathan S. <js...@cf...> - 2012年02月06日 14:20:10
Chris,
You might want to try a module written by Tom Robitaille (aka astrofrog)
called rasterized_scatter. Look for it on github.
Jon
On Mon, 2012年02月06日 at 21:28 +0900, Jae-Joon Lee wrote:
> Thanks. Now I understand the situation.
> 
> As far as I can see, marker="," is implemented as a rectangle path
> with width/height of 1 pixel, so this result in 2x2 pixel filled
> square.
> I tried to change the size of the rectangle, etc, to get a single
> pixel filled square, but did not get a satisfactory result.
> I think we need an Agg expert. I hope Mike or others take a look.
> 
> Chris,
> if you do not get a response from others in this mailing list, I
> recommend you to open a new issue in our github page.
> 
> Regards,
> 
> -JJ
> 
> 
> On Mon, Feb 6, 2012 at 1:53 AM, Chris <pl...@gm...> wrote:
> > Thanks JJ.
> >
> > The problem seems not to be a size issue -- markersize has no effect
> > when use marker="," (pixel). I have also tried to turn off aa, and it
> > doesn't help either. I also tried different backends. The PNG output
> > from Agg and Cairo is slightly different: Agg's point has 4 solid
> > pixel, while Cairo's has 4 pixel with random shade.
> >
> > Postscript output has the same problem. The "pixel" in an EPS file
> > generated by mpl is significantly bigger than that from another
> > drawing program I used.
> >
> > The problem occurs in all my plotting scripts, e.g., this basic one:
> >
> > [CODE]
> > import numpy as np
> >
> > x=np.arange(100)
> > y=np.random.randn(100)
> >
> > ioff()
> > fig=gcf()
> > fig.clf()
> >
> > ax=fig.add_axes(0.15,0.1,0.8, 0.85)
> > ax.plot(x,y,"k,")
> >
> > ion()
> > fig.canvas.draw()
> > [/CODE]
> >
> > Here is how I identify the problem:
> > 1. use the above script to plot on screen
> > 2. savefig("plot.png")
> > 3. open plot.png in GIMP and check the pixel size.
> >
> > I also attached the two PNG files generated with Agg and Cairo backends.
> >
> >
> > On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee <lee...@gm...> wrote:
> >> How are you plotting your points.
> >>
> >> If you use *plot*, there is a *markersize* parameter.
> >> If you use *scatter*, the third argument controls the marker size.
> >>
> >> But you may actually complaining about other issues, e.g.,
> >> antialiasing, etc. So, if above are not your answer, please post a
> >> complete example and describe your problem in more detail.
> >>
> >> Regards,
> >>
> >> -JJ
> >>
> >>
> >> On Sat, Feb 4, 2012 at 2:15 PM, Chris <pl...@gm...> wrote:
> >>> I noticed this a few years back, but left it aside because most of the
> >>> time I can live with it. Recently I need to make a few plots
> >>> containing a few million points, and 4 pixels for a point is a
> >>> disaster. So my question is why the pixel marker size is set at 4
> >>> pixels? And is there anyway to change it to a single pixel?
> >>>
> >>> Thanks,
> >>> Chris
From: Jae-Joon L. <lee...@gm...> - 2012年02月06日 12:29:18
Thanks. Now I understand the situation.
As far as I can see, marker="," is implemented as a rectangle path
with width/height of 1 pixel, so this result in 2x2 pixel filled
square.
I tried to change the size of the rectangle, etc, to get a single
pixel filled square, but did not get a satisfactory result.
I think we need an Agg expert. I hope Mike or others take a look.
Chris,
if you do not get a response from others in this mailing list, I
recommend you to open a new issue in our github page.
Regards,
-JJ
On Mon, Feb 6, 2012 at 1:53 AM, Chris <pl...@gm...> wrote:
> Thanks JJ.
>
> The problem seems not to be a size issue -- markersize has no effect
> when use marker="," (pixel). I have also tried to turn off aa, and it
> doesn't help either. I also tried different backends. The PNG output
> from Agg and Cairo is slightly different: Agg's point has 4 solid
> pixel, while Cairo's has 4 pixel with random shade.
>
> Postscript output has the same problem. The "pixel" in an EPS file
> generated by mpl is significantly bigger than that from another
> drawing program I used.
>
> The problem occurs in all my plotting scripts, e.g., this basic one:
>
> [CODE]
> import numpy as np
>
> x=np.arange(100)
> y=np.random.randn(100)
>
> ioff()
> fig=gcf()
> fig.clf()
>
> ax=fig.add_axes(0.15,0.1,0.8, 0.85)
> ax.plot(x,y,"k,")
>
> ion()
> fig.canvas.draw()
> [/CODE]
>
> Here is how I identify the problem:
> 1. use the above script to plot on screen
> 2. savefig("plot.png")
> 3. open plot.png in GIMP and check the pixel size.
>
> I also attached the two PNG files generated with Agg and Cairo backends.
>
>
> On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee <lee...@gm...> wrote:
>> How are you plotting your points.
>>
>> If you use *plot*, there is a *markersize* parameter.
>> If you use *scatter*, the third argument controls the marker size.
>>
>> But you may actually complaining about other issues, e.g.,
>> antialiasing, etc. So, if above are not your answer, please post a
>> complete example and describe your problem in more detail.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Sat, Feb 4, 2012 at 2:15 PM, Chris <pl...@gm...> wrote:
>>> I noticed this a few years back, but left it aside because most of the
>>> time I can live with it. Recently I need to make a few plots
>>> containing a few million points, and 4 pixels for a point is a
>>> disaster. So my question is why the pixel marker size is set at 4
>>> pixels? And is there anyway to change it to a single pixel?
>>>
>>> Thanks,
>>> Chris
>>>
>>> ------------------------------------------------------------------------------
>>> Try before you buy = See our experts in action!
>>> The most comprehensive online learning library for Microsoft developers
>>> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>>> Metro Style Apps, more. Free future releases when you subscribe now!
>>> http://p.sf.net/sfu/learndevnow-dev2
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi
I understand that it would be hard to implement, as it requires that all
the points are checked, which for a arbitrary plot is not easy.
Though is this not what is already done for the normal autoscale, or have I
misunderstood how the normal autoscale is done?
I would like to have this as a new feature, as it would prove useful for
analysing graphs, especially in scientific research.
Kind regards
Pål
On 3 February 2012 19:56, Eric Firing <ef...@ha...> wrote:
> On 02/03/2012 06:07 AM, Benjamin Root wrote:
> >
> >
> > On Fri, Feb 3, 2012 at 9:15 AM, Pål Gunnar Ellingsen <pa...@gm...
> > <mailto:pa...@gm...>> wrote:
> >
> > Hi
> >
> > Thank you for trying to help me, though I can't see how aspect is
> going
> > to help me. As I understand of the documentation, it would require
> > me to know the
> > relationship between x and y, which I don't.
> > I can calculate it, but since it varies between each change in
> xlimits
> > and different plot, it would be the same as calculating the ylimits.
> >
> > As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does
> > the same as ax.set_xlim() for me.
> >
> > Below is a sample code that will illustrate the problem.
> >
> > Regards
> >
> > Pål
> >
> > ####### Start code ############
> >
> > #!/usr/bin/env python
> > import matplotlib
> > matplotlib.use('Qt4Agg') # generate postscript output by default
> >
> > import matplotlib.pyplot as plt
> > import numpy as np
> >
> > # Creating a function to plot
> > x = np.linspace(-10, 10, 200)
> > p = np.poly1d([2, 3, 1, 4])
> > y = p(x) * np.sin(x)
> >
> > # plotting the full figure
> > fig = plt.figure()
> >
> > ax = fig.add_subplot(111)
> > ax.plot(x, y)
> > ax.autoscale(tight=True)
> > plt.title('Full graph. (Press key for next plot)')
> > plt.draw()
> >
> > plt.waitforbuttonpress()
> >
> > # This is how I'm currently doing it
> > # x limits
> > xmin = 2
> > xmax = 6
> >
> > # Calculating y limits
> > ymin = y[np.logical_and(xmin < x, x < xmax)].min()
> > ymax = y[np.logical_and(xmin < x, x < xmax)].max()
> >
> > # Inserting some room
> > room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
> > ymin = ymin + room * np.sign(ymin)
> > ymax = ymax + room * np.sign(ymax)
> >
> > # Setting the limits
> > ax.set_xlim([xmin, xmax])
> > ax.set_ylim([ymin, ymax])
> >
> > plt.title('What I want (Press key for next plot)')
> > plt.draw()
> > plt.waitforbuttonpress()
> >
> > # This is what pyplot does by default if I only set the limits
> > ax.autoscale(tight=True)
> > ax.set_xlim([2, 6])
> >
> > plt.title('What I get if I only use set_xlim (Press key for exit)')
> > plt.draw()
> > plt.waitforbuttonpress()
> > plt.close()
> >
> > ####### End code ############
> >
> >
> >
> > Ok, I see what you want. You want the y-limits to automatically change
> > to fit only the data that is displayed for the x-domain you have chosen.
>
> This has never been supported; it would have to be a new option. I
> suspect it would be quite difficult to get this right in general, even
> though the concept seems simple enough.
>
> Eric
>
> >
> > I have tried some tricks, and I am not sure that it is currently
> > possible. There might even be some sort of bug at play here because the
> > function ax.update_datalim() does not appear to update the internal data
> > used for autoscaling. We might have to look into this further.
> >
> > Ben Root
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Try before you buy = See our experts in action!
> > The most comprehensive online learning library for Microsoft developers
> > is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> > Metro Style Apps, more. Free future releases when you subscribe now!
> > http://p.sf.net/sfu/learndevnow-dev2
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Fabrice S. <si...@lm...> - 2012年02月06日 10:27:09
On Sat, Feb 4, 2012 at 9:44 AM, Fabrice Silva <si...@lm...> wrote:
> Le vendredi 03 février 2012 à 17:39 +0000, David Craig a écrit :
> > sure how to get it to plot the outputs from specgram. I use
> > specgram as follows,
> > Pxx, freqs, bins, im = plt.specgram(......)
> > what am I trying imshow??
> 
> 
> plt.specgram computes the spectrogram and when calls imshow to display
> the resulting array into an image
> 
> Please tell the shape of Pxx, and try the following
> 
> import numpy as np
> import matplotlib.pyplot as plt
> a = np.empty((12000, 14400), dtype=float)
> plt.imshow(a)
> plt.show()
Le samedi 04 février 2012 à 10:30 +0000, David Craig a écrit :
> Pxx has shape (6001, 1430) and when I tried the lines of code it returned the following memory error,
> 
> Traceback (most recent call last):
> File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 394, in expose_event
> self._render_figure(self._pixmap, w, h)
> File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure
> FigureCanvasAgg.draw(self)
> File "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 394, in draw
> self.figure.draw(self.renderer)
> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 798, in draw
> func(*args)
> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 1946, in draw
> a.draw(renderer)
> File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 354, in draw
> im = self.make_image(renderer.get_image_magnification())
> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 569, in make_image
> transformed_viewLim)
> File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 201, in _get_unsampled_image
> x = self.to_rgba(self._A, self._alpha)
> File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line 193, in to_rgba
> x = self.norm(x)
> File "/usr/lib/python2.7/site-packages/matplotlib/colors.py", line 802, in __call__
> val = ma.asarray(value).astype(np.float)
> File "/usr/lib/python2.7/site-packages/numpy/ma/core.py", line 2908, in astype
> output = self._data.astype(newtype).view(type(self))
> MemoryError
Please, answer on the mailing list,
It confirms that the troubles lie in the rendering of images. Could you
tell the versions of numpy and matplotlib you are using, and the
characteristics of the computer you are working on ?
From: Fabien L. <laf...@gm...> - 2012年02月06日 09:43:52
The question is inside the title...
From: Martin M. <mmo...@fo...> - 2012年02月05日 17:56:09
HI,
 I have troubles getting to wirk a hitogram plot. I have colors in
RGB as tuples of 3 values and also some colors defined as string,
e.g. 'orange'. I get the folowing error:
 File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 2332, in hist
 ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 7598, in hist
 raise ValueError("color kwarg must have one color per dataset")
ValueError: color kwarg must have one color per dataset
 I think it is about the code in this patch:
http://permalink.gmane.org/gmane.comp.python.matplotlib.scm/4600
 I hacked a bit the code in colors.py and axes.py to get more debug.
As you can see below it seems a previous value if left in the colors variable
from a previous iteration (I think).
['orange', (0.9468480101059871, 1.0, 0.0)] = colors[:2]
[cut]
 pylab.hist(counts[:2], histtype='bar', align='mid', log=True, bins=len(counts[:2]), color=colors[:2], label=adapternames[:2])
 File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 2332, in hist
 ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 7598, in hist
 raise ValueError("color kwarg must have one color per dataset: color=%d, nx=%d, color='%s', nx='%s'" % (len(color), nx, str(color), str(nx)))
ValueError: color kwarg must have one color per dataset: color=2, nx=1, color='[[ 1. 0.64705882 0. 1. ]
 [ 0.94684801 1. 0. 1. ]]', nx='1'
 Alternatively I would believe that matplotlib breaks because I have for different
data points same color ('orange' appears maybe 10x in my colors list) but the above slice [:2]
excludes this a the cause I am getting right now.
If it matters I generated the colors by this approach:
 for _n in range(1,cnt1 + 1):
 _h1 = sorted([uniform(0.15, 0.85) for x in range(_n)])
 _HSV_tuples1 = [(_h1[x], 1.0, 1.0) for x in range(_n)]
 _RGB_tuples1 = map(lambda x: colorsys.hsv_to_rgb(*x), _HSV_tuples1)
but these are mixed together with those defined as string (e.g. 'orange')
before they are sent to matplotlib.
Thank you for you help.
Martin
BTW: Would be nice if the default error messages on the above shown raise() were
more detailed.
From: Chris <pl...@gm...> - 2012年02月05日 16:54:03
Thanks JJ.
The problem seems not to be a size issue -- markersize has no effect
when use marker="," (pixel). I have also tried to turn off aa, and it
doesn't help either. I also tried different backends. The PNG output
from Agg and Cairo is slightly different: Agg's point has 4 solid
pixel, while Cairo's has 4 pixel with random shade.
Postscript output has the same problem. The "pixel" in an EPS file
generated by mpl is significantly bigger than that from another
drawing program I used.
The problem occurs in all my plotting scripts, e.g., this basic one:
[CODE]
import numpy as np
x=np.arange(100)
y=np.random.randn(100)
ioff()
fig=gcf()
fig.clf()
ax=fig.add_axes(0.15,0.1,0.8, 0.85)
ax.plot(x,y,"k,")
ion()
fig.canvas.draw()
[/CODE]
Here is how I identify the problem:
1. use the above script to plot on screen
2. savefig("plot.png")
3. open plot.png in GIMP and check the pixel size.
I also attached the two PNG files generated with Agg and Cairo backends.
On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee <lee...@gm...> wrote:
> How are you plotting your points.
>
> If you use *plot*, there is a *markersize* parameter.
> If you use *scatter*, the third argument controls the marker size.
>
> But you may actually complaining about other issues, e.g.,
> antialiasing, etc. So, if above are not your answer, please post a
> complete example and describe your problem in more detail.
>
> Regards,
>
> -JJ
>
>
> On Sat, Feb 4, 2012 at 2:15 PM, Chris <pl...@gm...> wrote:
>> I noticed this a few years back, but left it aside because most of the
>> time I can live with it. Recently I need to make a few plots
>> containing a few million points, and 4 pixels for a point is a
>> disaster. So my question is why the pixel marker size is set at 4
>> pixels? And is there anyway to change it to a single pixel?
>>
>> Thanks,
>> Chris
>>
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> The most comprehensive online learning library for Microsoft developers
>> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-dev2
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: gsal <sal...@gm...> - 2012年02月05日 15:15:34
Yeap, that did the trick.
Thanks.
-- 
View this message in context: http://old.nabble.com/legend-not-draggable-when-secondary-y-axis-present-tp33163397p33266687.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2012年02月05日 14:45:28
How are you plotting your points.
If you use *plot*, there is a *markersize* parameter.
If you use *scatter*, the third argument controls the marker size.
But you may actually complaining about other issues, e.g.,
antialiasing, etc. So, if above are not your answer, please post a
complete example and describe your problem in more detail.
Regards,
-JJ
On Sat, Feb 4, 2012 at 2:15 PM, Chris <pl...@gm...> wrote:
> I noticed this a few years back, but left it aside because most of the
> time I can live with it. Recently I need to make a few plots
> containing a few million points, and 4 pixels for a point is a
> disaster. So my question is why the pixel marker size is set at 4
> pixels? And is there anyway to change it to a single pixel?
>
> Thanks,
> Chris
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2012年02月05日 14:36:11
For the legend to be picked by mouse, it must be placed in the top most axes.
ax = subplot(111)
l1, = ax.plot([1,3,2])
ax2 = ax.twinx()
lab = ax2.legend([l1], ["test"])
I hope this clarifies your issue.
If not, please post a simple but complete example that demonstrates
your problem.
Regards,
-JJ
On Wed, Jan 18, 2012 at 12:53 AM, German Salazar <sal...@gm...> wrote:
> Any ideas?
>
> Also, as in the example here, the legend seems to be behind the quantity
> being plotted against the one of the secondary y-axis....does this have
> anything to do with that?...it is that maybe the legend is draggable but I
> am not getting to it?
>
> gsal
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2012年02月05日 14:28:33
On Sat, Feb 4, 2012 at 1:27 AM, Saurav Pathak <sa...@sa...> wrote:
> Is there another way to do this more efficiently?
I recommend you to use LineCollection, which should be much efficient.
http://matplotlib.sourceforge.net/examples/api/collections_demo.html
Regards,
-JJ
From: Warren W. <war...@en...> - 2012年02月04日 21:13:01
On Mon, Jan 23, 2012 at 3:19 PM, Paul Ivanov <piv...@gm...> wrote:
> Paul Ivanov, on 2012年01月23日 13:07, wrote:
> > the quick and dirty way to get close to what you want is to add
> > an alpha value to the lines you're already plotting. Here's a
> > small example:
> >
> > x = np.arange(0,3,.01)
> > y = np.sin(x**2)
> > all_x,all_y = [],[]
> > ax = plt.gca()
> > for i in range(100):
> > noisex = np.random.randn(1)*.04
> > noisey = (np.random.randn(x.shape[0])*.2)**3
> > ax.plot(x+noisex,y+noisey, color='b', alpha=.01)
> > all_x.append(x+noisex)
> > all_y.append(y+noisey)
> >
> > To get a heat diagram, as was suggested, you can use a 2d
> > histogram.
> >
> > plt.figure()
> > all_x =np.array(all_x)
> > all_y = np.array(all_y)
> > all_x.shape = all_y.shape = -1
> > H, yedges, xedges = np.histogram2d(all_y, all_x, bins=100)
> > extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]]
> > ax = plt.gca()
> > plt.hot()
> > ax.imshow(H, extent=extent, interpolation='nearest')
> > ax.invert_yaxis()
>
> For completeness, attached is what the hexbin version of the same
> data looks like:
>
> plt.hexbin(all_x, all_y)
>
> You may want to play with the 'bins' (for histogram2d) and
> 'griddata' (for hexbin) parameters to get the appropriate level
> of detail for the amount of data you have.
>
>
To get a proper count of the 2D bins that each curve crosses, you could
parameterize the curve by arclength and resample it use a small step size.
Or, you could linearly interpolate between the curve's discretized data
points using Bresenham's line algorithm. The latter seemed like a
straightforward approach, so I wrote it up and added it to the SciPy
Cookbook:
 http://www.scipy.org/Cookbook/EyeDiagram
Warren
From: phils <phi...@ho...> - 2012年02月04日 15:41:29
Newbie to using matplotlib
Is it possible to use wx and have a window with say 2 buttons on where when
clicking on either button a different graph will appear using a different
data set. Any examples?
Regards
Phil
-- 
View this message in context: http://old.nabble.com/Switch-graphs-tp33263048p33263048.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Fabrice S. <si...@lm...> - 2012年02月04日 09:44:51
Le vendredi 03 février 2012 à 17:39 +0000, David Craig a écrit :
> sure how to get it to plot the outputs from specgram. I use 
> specgram as follows,
> Pxx, freqs, bins, im = plt.specgram(......)
> what am I trying imshow?? 
plt.specgram computes the spectrogram and when calls imshow to display
the resulting array into an image
Please tell the shape of Pxx, and try the following
import numpy as np
import matplotlib.pyplot as plt
a = np.empty((12000, 14400), dtype=float)
plt.imshow(a)
plt.show()
From: Chris <pl...@gm...> - 2012年02月04日 05:15:30
I noticed this a few years back, but left it aside because most of the
time I can live with it. Recently I need to make a few plots
containing a few million points, and 4 pixels for a point is a
disaster. So my question is why the pixel marker size is set at 4
pixels? And is there anyway to change it to a single pixel?
Thanks,
Chris
From: Benjamin R. <ben...@ou...> - 2012年02月04日 04:29:57
On Friday, February 3, 2012, Jacob Biesinger <jak...@gm...>
wrote:
> Hi!
> In matplotlib's 3d plotting, the three corners of the 3d cube closest to
the camera are used as the axis and receive tick marks, labels, and a dark
black line. Is it possible to have the black line and ticks show
simultaneously on the 3 far corners at the top of the cube?
> For example, I'd like to have the top-left corner, top-right corner and
right side of this image be dark and include ticks, but not tick labels.
> http://dl.dropbox.com/u/1299034/fig_example.png
> Thanks!
>
Unfortunately, that level of customization is not in the design of mplot3d.
 It it possible that it may happen in future releases as I work to bring
mplot3d into feature-parity with regular axes, it won't happen soon.
Now, that doesn't mean that it is impossible to do right now, but it would
require hacking the axis3d.py file. For each axis, a panel is drawn (which
is what you see now). It is possible to simply have it plot a second
(transparent) panel on the far side with a black outline. Next, there is a
loop that makes the ticks and the labels at the same time. Just duplicate
that loop, but for the far edge and exclude the labels.
Sorry I can't be of more help right now, but I hope this info gets you
where you need to be.
Cheers,
Ben Root
From: Jacob B. <jak...@gm...> - 2012年02月04日 00:54:26
Hi!
In matplotlib's 3d plotting, the three corners of the 3d cube closest to
the camera are used as the axis and receive tick marks, labels, and a dark
black line. Is it possible to have the black line and ticks show
simultaneously on the 3 far corners at the top of the cube?
For example, I'd like to have the top-left corner, top-right corner and
right side of this image be dark and include ticks, but not tick labels.
http://dl.dropbox.com/u/1299034/fig_example.png
Thanks!
From: Friedrich R. <fri...@gm...> - 2012年02月03日 20:34:18
> I am having troubles getting matplotlib to install. I have mac os X lion with Xcode 4.2.1 installed and I have used git to get the latest version of matplotlib. I am also running python 2.7.2 from the python.org site. The installation process was going fine based on the make.osx file supplied . The only thing I had to do was add a symbolic link to map gcc-4.2 to gcc to get it to compile, the I hit the following problem:
So what do you mean precisely by "the installation process was going fine" if you hit that complile error? So it did't go fine AISI, no?
> In file included from src/ft2font.cpp:3:
> src/ft2font.h:16:22: error: ft2build.h: No such file or directory
AFAIR this means it did't find the freetype2 installation sources. Either it's some mistake in make.osx or you did one. Can't say anything emphatically at this stage. Normally the make.osx installs the freetype2 somewhere. 
> src/ft2font.h:17:10: error: #include expects "FILENAME" or <FILENAME>
You could have a look which include that is. I don't have the sources here. 
Sorry for the slow reply. 
Friedrich
On 02/03/2012 06:07 AM, Benjamin Root wrote:
>
>
> On Fri, Feb 3, 2012 at 9:15 AM, Pål Gunnar Ellingsen <pa...@gm...
> <mailto:pa...@gm...>> wrote:
>
> Hi
>
> Thank you for trying to help me, though I can't see how aspect is going
> to help me. As I understand of the documentation, it would require
> me to know the
> relationship between x and y, which I don't.
> I can calculate it, but since it varies between each change in xlimits
> and different plot, it would be the same as calculating the ylimits.
>
> As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does
> the same as ax.set_xlim() for me.
>
> Below is a sample code that will illustrate the problem.
>
> Regards
>
> Pål
>
> ####### Start code ############
>
> #!/usr/bin/env python
> import matplotlib
> matplotlib.use('Qt4Agg') # generate postscript output by default
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> # Creating a function to plot
> x = np.linspace(-10, 10, 200)
> p = np.poly1d([2, 3, 1, 4])
> y = p(x) * np.sin(x)
>
> # plotting the full figure
> fig = plt.figure()
>
> ax = fig.add_subplot(111)
> ax.plot(x, y)
> ax.autoscale(tight=True)
> plt.title('Full graph. (Press key for next plot)')
> plt.draw()
>
> plt.waitforbuttonpress()
>
> # This is how I'm currently doing it
> # x limits
> xmin = 2
> xmax = 6
>
> # Calculating y limits
> ymin = y[np.logical_and(xmin < x, x < xmax)].min()
> ymax = y[np.logical_and(xmin < x, x < xmax)].max()
>
> # Inserting some room
> room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
> ymin = ymin + room * np.sign(ymin)
> ymax = ymax + room * np.sign(ymax)
>
> # Setting the limits
> ax.set_xlim([xmin, xmax])
> ax.set_ylim([ymin, ymax])
>
> plt.title('What I want (Press key for next plot)')
> plt.draw()
> plt.waitforbuttonpress()
>
> # This is what pyplot does by default if I only set the limits
> ax.autoscale(tight=True)
> ax.set_xlim([2, 6])
>
> plt.title('What I get if I only use set_xlim (Press key for exit)')
> plt.draw()
> plt.waitforbuttonpress()
> plt.close()
>
> ####### End code ############
>
>
>
> Ok, I see what you want. You want the y-limits to automatically change
> to fit only the data that is displayed for the x-domain you have chosen.
This has never been supported; it would have to be a new option. I 
suspect it would be quite difficult to get this right in general, even 
though the concept seems simple enough.
Eric
>
> I have tried some tricks, and I am not sure that it is currently
> possible. There might even be some sort of bug at play here because the
> function ax.update_datalim() does not appear to update the internal data
> used for autoscaling. We might have to look into this further.
>
> Ben Root
>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2012年02月03日 16:55:31
On Fri, Feb 3, 2012 at 10:27 AM, Saurav Pathak <sa...@sa...> wrote:
> Hi All,
>
> First, thanks for a very cool and pretty tool!
>
> My problem is, I have a 2D numpy array, say m by n, and I would like to
> display the data in n plots (with the same abscissa). That is, the 2D
> numpy array holds n time series data with m points each. I could use
> pyplot.plot inside a loop to display it, but n is very large as a result
> of which it takes a long time to create the plot and display it.
>
> Is there another way to do this more efficiently?
>
> Thanks,
> Saurav
>
>
Just pass in the 2D array as the 'y' argument. A line plot will be made
for each column in the 2D array and will even be automatically colored.
All lines will show up on the same axes.
Cheers!
Ben Root
Hi
Yes you've understood my problem correctly.
Let me know if there is anything I can do to help solve this issue.
Regards
Pål
On 3 February 2012 17:07, Benjamin Root <ben...@ou...> wrote:
>
>
> On Fri, Feb 3, 2012 at 9:15 AM, Pål Gunnar Ellingsen <pa...@gm...>wrote:
>
>> Hi
>>
>> Thank you for trying to help me, though I can't see how aspect is going
>> to help me. As I understand of the documentation, it would require me to
>> know the
>> relationship between x and y, which I don't.
>> I can calculate it, but since it varies between each change in xlimits
>> and different plot, it would be the same as calculating the ylimits.
>>
>> As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does the
>> same as ax.set_xlim() for me.
>>
>> Below is a sample code that will illustrate the problem.
>>
>> Regards
>>
>> Pål
>>
>> ####### Start code ############
>>
>> #!/usr/bin/env python
>> import matplotlib
>> matplotlib.use('Qt4Agg') # generate postscript output by default
>>
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> # Creating a function to plot
>> x = np.linspace(-10, 10, 200)
>> p = np.poly1d([2, 3, 1, 4])
>> y = p(x) * np.sin(x)
>>
>> # plotting the full figure
>> fig = plt.figure()
>>
>> ax = fig.add_subplot(111)
>> ax.plot(x, y)
>> ax.autoscale(tight=True)
>> plt.title('Full graph. (Press key for next plot)')
>> plt.draw()
>>
>> plt.waitforbuttonpress()
>>
>> # This is how I'm currently doing it
>> # x limits
>> xmin = 2
>> xmax = 6
>>
>> # Calculating y limits
>> ymin = y[np.logical_and(xmin < x, x < xmax)].min()
>> ymax = y[np.logical_and(xmin < x, x < xmax)].max()
>>
>> # Inserting some room
>> room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
>> ymin = ymin + room * np.sign(ymin)
>> ymax = ymax + room * np.sign(ymax)
>>
>> # Setting the limits
>> ax.set_xlim([xmin, xmax])
>> ax.set_ylim([ymin, ymax])
>>
>> plt.title('What I want (Press key for next plot)')
>> plt.draw()
>> plt.waitforbuttonpress()
>>
>> # This is what pyplot does by default if I only set the limits
>> ax.autoscale(tight=True)
>> ax.set_xlim([2, 6])
>>
>> plt.title('What I get if I only use set_xlim (Press key for exit)')
>> plt.draw()
>> plt.waitforbuttonpress()
>> plt.close()
>>
>> ####### End code ############
>>
>>
>>
> Ok, I see what you want. You want the y-limits to automatically change to
> fit only the data that is displayed for the x-domain you have chosen.
>
> I have tried some tricks, and I am not sure that it is currently
> possible. There might even be some sort of bug at play here because the
> function ax.update_datalim() does not appear to update the internal data
> used for autoscaling. We might have to look into this further.
>
> Ben Root
>
>
From: Saurav P. <sa...@sa...> - 2012年02月03日 16:44:23
Hi All,
First, thanks for a very cool and pretty tool!
My problem is, I have a 2D numpy array, say m by n, and I would like to 
display the data in n plots (with the same abscissa). That is, the 2D 
numpy array holds n time series data with m points each. I could use 
pyplot.plot inside a loop to display it, but n is very large as a result 
of which it takes a long time to create the plot and display it.
Is there another way to do this more efficiently?
Thanks,
Saurav
On Fri, Feb 3, 2012 at 9:15 AM, Pål Gunnar Ellingsen <pa...@gm...>wrote:
> Hi
>
> Thank you for trying to help me, though I can't see how aspect is going
> to help me. As I understand of the documentation, it would require me to
> know the
> relationship between x and y, which I don't.
> I can calculate it, but since it varies between each change in xlimits
> and different plot, it would be the same as calculating the ylimits.
>
> As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does the same
> as ax.set_xlim() for me.
>
> Below is a sample code that will illustrate the problem.
>
> Regards
>
> Pål
>
> ####### Start code ############
>
> #!/usr/bin/env python
> import matplotlib
> matplotlib.use('Qt4Agg') # generate postscript output by default
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> # Creating a function to plot
> x = np.linspace(-10, 10, 200)
> p = np.poly1d([2, 3, 1, 4])
> y = p(x) * np.sin(x)
>
> # plotting the full figure
> fig = plt.figure()
>
> ax = fig.add_subplot(111)
> ax.plot(x, y)
> ax.autoscale(tight=True)
> plt.title('Full graph. (Press key for next plot)')
> plt.draw()
>
> plt.waitforbuttonpress()
>
> # This is how I'm currently doing it
> # x limits
> xmin = 2
> xmax = 6
>
> # Calculating y limits
> ymin = y[np.logical_and(xmin < x, x < xmax)].min()
> ymax = y[np.logical_and(xmin < x, x < xmax)].max()
>
> # Inserting some room
> room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
> ymin = ymin + room * np.sign(ymin)
> ymax = ymax + room * np.sign(ymax)
>
> # Setting the limits
> ax.set_xlim([xmin, xmax])
> ax.set_ylim([ymin, ymax])
>
> plt.title('What I want (Press key for next plot)')
> plt.draw()
> plt.waitforbuttonpress()
>
> # This is what pyplot does by default if I only set the limits
> ax.autoscale(tight=True)
> ax.set_xlim([2, 6])
>
> plt.title('What I get if I only use set_xlim (Press key for exit)')
> plt.draw()
> plt.waitforbuttonpress()
> plt.close()
>
> ####### End code ############
>
>
>
Ok, I see what you want. You want the y-limits to automatically change to
fit only the data that is displayed for the x-domain you have chosen.
I have tried some tricks, and I am not sure that it is currently possible.
There might even be some sort of bug at play here because the function
ax.update_datalim() does not appear to update the internal data used for
autoscaling. We might have to look into this further.
Ben Root
6 messages has been excluded from this view by a project administrator.

Showing results of 408

<< < 1 .. 13 14 15 16 17 > >> (Page 15 of 17)
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 によって変換されたページ (->オリジナル) /