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
(9) |
2
(8) |
3
|
4
(6) |
5
|
6
|
7
(41) |
8
(18) |
9
(25) |
10
(18) |
11
(10) |
12
(13) |
13
(7) |
14
(4) |
15
(12) |
16
(6) |
17
(9) |
18
(7) |
19
(2) |
20
(5) |
21
(7) |
22
(2) |
23
(11) |
24
(11) |
25
(14) |
26
(3) |
27
(3) |
28
(17) |
29
(7) |
30
(16) |
31
(8) |
|
|
On Thu, Mar 10, 2011 at 8:40 AM, Auré Gourrier <aur...@ya...>wrote: > Dear all, > > Once again, I turn for help. > I'm trying to plot a polar image using colormap values for the theta values > and increasing alpha values along the radius. > I do this using imshow passing the rgba tuple at each pixel position which > works very nicely with rectangular axes, but fails to display using polar > axes (see code below). > As usual, I've done a fair bit of digging to find where the problem is and > whether I could make out an alternate solution but haven't managed to come > through. I've tried using pcolormesh but I don't see how to pass the rgba > tuple > Can anyone point me in the right direction. > I'm using matplotlib 1.0.1 and Python 2.4 > > Cheers, > > Auré > > It appears that imshow() (and matshow()) do not support non-rectilinear axes. I don't know if this is a bug or if there is no way to make it support polar projections. Hopefully, someone else more knowledgable could chime in on this. I am also not exactly sure how to accomplish what you want using pcolor. A really slow, painful way would be to pcolor each row with the rest masked out, setting the alpha value for that row. I have long wondered if the alpha kwarg in various functions could be improved by allowing array values and take advantage of numpy broadcasting. Ben Root
Hi Ben, thanks a lot, this really helpes in the simple example, I'll try to find out how to use it in the complex script. It seems 1.0.0 is recent enough for this! Thanks again, Daniel 2011年3月10日 Benjamin Root <ben...@ou...>: > > > On Thu, Mar 10, 2011 at 4:54 AM, Daniel Mader > <dan...@go...> wrote: >> >> Hi, >> >> is it possible to change the default y-axis scaling so that the >> ticks/label are not with respect to the large offset? >> >> For example: >> >> import scipy >> import pylab >> >> x = scipy.arange(100) >> y = scipy.rand(100) + 1000006 >> >> pylab.figure() >> pylab.plot(x,y) >> pylab.grid() >> >> pylab.show() >> >> This gives the y-limits as (0,1) with respect to 1000006. This makes >> it very hard to read. I'd like to be able to configure this manually. >> >> Thanks in advance, >> Daniel >> > > I tried to fix matplotlib to be smarter about choosing the offset value a > while back, but I couldn't come up with something that worked well in the > general case. You can manually turn it off completely, and have the full > value displayed (or even manually set the offset value). If you have a very > recent matplotlib: > > import matplotlib.pyplot as plt > import numpy as np > > x = np.arange(100) > y = np.random.rand(100) + 1000006 > > plt.figure() > plt.plot(x, y) > plt.grid() > plt.ticklabel_format(useOffset=1000000, axis='y') > > plt.show() > > Or you can turn it off by setting useOffset to False. > > If you don't have a recent enough matplotlib, you can turn it off completely > by doing something like this: > > import matplotlib.pyplot as plt > import numpy as np > from matplotlib.ticker import ScalarFormatter > > x = np.arange(100) > y = np.random.rand(100) + 1000006 > > fig = plt.figure() > ax = fig.gca() > ax.plot(x, y) > ax.grid() > ax.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) > > plt.show() > > > I hope this helps! > Ben Root > >
On Thu, Mar 10, 2011 at 4:54 AM, Daniel Mader < dan...@go...> wrote: > Hi, > > is it possible to change the default y-axis scaling so that the > ticks/label are not with respect to the large offset? > > For example: > > import scipy > import pylab > > x = scipy.arange(100) > y = scipy.rand(100) + 1000006 > > pylab.figure() > pylab.plot(x,y) > pylab.grid() > > pylab.show() > > This gives the y-limits as (0,1) with respect to 1000006. This makes > it very hard to read. I'd like to be able to configure this manually. > > Thanks in advance, > Daniel > > I tried to fix matplotlib to be smarter about choosing the offset value a while back, but I couldn't come up with something that worked well in the general case. You can manually turn it off completely, and have the full value displayed (or even manually set the offset value). If you have a very recent matplotlib: import matplotlib.pyplot as plt import numpy as np x = np.arange(100) y = np.random.rand(100) + 1000006 plt.figure() plt.plot(x, y) plt.grid() plt.ticklabel_format(useOffset=1000000, axis='y') plt.show() Or you can turn it off by setting useOffset to False. If you don't have a recent enough matplotlib, you can turn it off completely by doing something like this: import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter x = np.arange(100) y = np.random.rand(100) + 1000006 fig = plt.figure() ax = fig.gca() ax.plot(x, y) ax.grid() ax.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) plt.show() I hope this helps! Ben Root
The hist function expects a list of values that it bins up and counts to form the histogram (see numpy.hist). That's why it is plotting one "count" for each of the values you gave it. You already have your counts, you just want to make a step plot out of them. Look at the "drawstyle" keyword of the "plot" function: drawstyle: [ 'default' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' ] Hope that puts you on the right track. -Roban On Thu, Mar 10, 2011 at 4:18 PM, Andrea Crotti <and...@gm...> wrote: > I'm having some troubles understanding basic concepts. > Suppose I want to do something like this, given a dictionary > > values = { (0,10) : 0.5, > (10, 20) : 0.3 } > and so on, where the key is a time slot interval and the value is the > value I want to plot. > > What should be the correct way to get what I want? > > In theory the data that I want to plot is [0.5, 0.3] > but if I do > > plt.hist(values.values()) > > I don't get that, but I get 2 bars of length 1 located in that x > coordinate. So how should I proceed then? > > Thanks, > Andrea > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
I'm having some troubles understanding basic concepts. Suppose I want to do something like this, given a dictionary values = { (0,10) : 0.5, (10, 20) : 0.3 } and so on, where the key is a time slot interval and the value is the value I want to plot. What should be the correct way to get what I want? In theory the data that I want to plot is [0.5, 0.3] but if I do plt.hist(values.values()) I don't get that, but I get 2 bars of length 1 located in that x coordinate. So how should I proceed then? Thanks, Andrea
I'm having some troubles understanding basic concepts. Suppose I want to do something like this, given a dictionary values = { (0,10) : 0.5, (10, 20) : 0.3 } and so on, where the key is a time slot interval and the value is the value I want to plot. What should be the correct way to get what I want? In theory the data that I want to plot is [0.5, 0.3] but if I do plt.hist(values.values()) I don't get that, but I get 2 bars of length 1 located in that x coordinate. So how should I proceed then? Thanks, Andrea
Andrea Crotti <and...@gm...> writes: > values = { (0,10) : 0.5, > (10, 20) : 0.3 } > and so on, where the key is a time slot interval and the value is the > value I want to plot. > > What should be the correct way to get what I want? Something like this perhaps: left, width = zip(*[(a, b-a) for (a,b) in values.keys()]) bar(left, values.values(), width) That is, turn the sequence of intervals into a sequence of coordinates where the bars should start (left) and another sequence of bar widths. Then use bar to plot the values. > In theory the data that I want to plot is [0.5, 0.3] > but if I do > > plt.hist(values.values()) The hist function not only plots the histogram bars but computes them from the data. Use bar when you already have the coordinates you want to plot. -- Jouni K. Seppänen http://www.iki.fi/jks
Dear all, Once again, I turn for help. I'm trying to plot a polar image using colormap values for the theta values and increasing alpha values along the radius. I do this using imshow passing the rgba tuple at each pixel position which works very nicely with rectangular axes, but fails to display using polar axes (see code below). As usual, I've done a fair bit of digging to find where the problem is and whether I could make out an alternate solution but haven't managed to come through. I've tried using pcolormesh but I don't see how to pass the rgba tuple Can anyone point me in the right direction. I'm using matplotlib 1.0.1 and Python 2.4 Cheers, Auré ------ import matplotlib as mpl from matplotlib import pylab import numpy as np #build custom colormap cm_sym =customfunc() #define mesh grid theta = np.arange(0.,2.*math.pi+2.*math.pi/9,2.*math.pi/9) r = np.arange(0,1.1,0.1) X,Y = np.meshgrid(r,theta) #define rgba array polarcolorseq = mpl.cm.ScalarMappable(cmap=cm_hsvsym).to_rgba(Y) #set an increasing alpha value along the radius polarcolorseq[:,:,-1] = [list(np.arange(0,1.1,.1))]*10 pylab.figure(figsize=(10,5),dpi=100,facecolor='white') #display using rectangular axis ax = pylab.subplot((121),axisbg='k') ax.imshow(np.flipud(np.swapaxes(polarcolorseq,0,1))) #display using polar axis ax2 = pylab.subplot((122),axisbg='k',projection='polar') #also tried with polar=True ax2.imshow(np.flipud(np.swapaxes(polarcolorseq,0,1))) pylab.draw()
I'm having some troubles understanding basic concepts. Suppose I want to do something like this, given a dictionary values = { (0,10) : 0.5, (10, 20) : 0.3 } and so on, where the key is a time slot interval and the value is the value I want to plot. What should be the correct way to get what I want? In theory the data that I want to plot is [0.5, 0.3] but if I do plt.hist(values.values()) I don't get that, but I get 2 bars of length 1 located in that x coordinate. So how should I proceed then? Thanks, Andrea
Maybe I should mention that there are actually two reasons why I don't like this behavior: 1) it's sometimes very hard to read what's going on, 2) there also seems to be a bug when the limits are changed later, see attached results: the upper subplot is default, the lower subplot uses the padding. ##-------------------------- def update_ax2(ax1): ''' Automatically update ylim of ax2 when ylim of ax1 changes. ''' y1, y2 = ax1.get_ylim() ## modify the limits ax2.set_ylim((Tc(y1), Tc(y2))) ax2.figure.canvas.draw() Both plots are actually identical but use a different x-axis. In ordert to create a nicely padded plot, I use the following function, which breaks the scaling information AND the calculation of the second axis limits: ##-------------------------- def axispaddingAX(ax): ''' Saubere bzw. schoene Achsenskalierung für MPL-Skripten. ''' lines = ax.get_lines() xtemp = [] ytemp = [] for line in lines: xtemp.append(min(line.get_xdata())) xtemp.append(max(line.get_xdata())) ytemp.append(min(line.get_ydata())) ytemp.append(max(line.get_ydata())) xmin,xmax = min(xtemp),max(xtemp) ymin,ymax = min(ytemp),max(ytemp) span = 0.05 rangex = (xmin-span*(xmax-xmin), xmax+span*(xmax-xmin)) rangey = (ymin-span*(ymax-ymin), ymax+span*(ymax-ymin)) ax.set_xlim(rangex) ax.set_ylim(rangey) Thanks a lot in advance for any hint or comment on this, Daniel 2011年3月10日 Daniel Mader <dan...@go...>: > Hi, > > is it possible to change the default y-axis scaling so that the > ticks/label are not with respect to the large offset? > > For example: > > import scipy > import pylab > > x = scipy.arange(100) > y = scipy.rand(100) + 1000006 > > pylab.figure() > pylab.plot(x,y) > pylab.grid() > > pylab.show() > > This gives the y-limits as (0,1) with respect to 1000006. This makes > it very hard to read. I'd like to be able to configure this manually. > > Thanks in advance, > Daniel >
Hi, is it possible to change the default y-axis scaling so that the ticks/label are not with respect to the large offset? For example: import scipy import pylab x = scipy.arange(100) y = scipy.rand(100) + 1000006 pylab.figure() pylab.plot(x,y) pylab.grid() pylab.show() This gives the y-limits as (0,1) with respect to 1000006. This makes it very hard to read. I'd like to be able to configure this manually. Thanks in advance, Daniel
Hi all, I am stuck on matplotlib generating a segfault when invoking 'plot'. I've ben trying to solve this problem for a while now but no luck. I've seen many duplicates of this problem on the web, some with solutions, some without. The solution must be something more generic that I'm missing. Here are some of these pointers to the same problem that I have (the backtrace, that I pasted further below, has the same properties) http://old.nabble.com/101-Point-Segmentation-Fault-td27552745.html http://old.nabble.com/weird-error-with-gcc-4.4,-gomp,-cython,-and-matplotlib-td27351399.html http://bugs.gentoo.org/show_bug.cgi?id=338513 So here's my specific setup and backtrace. I hope I can find some help! I'm using the 'agg' backend that's it, and the build and install dir were cleaned up. Thanks so much! === Solaris10, 64bits, Python 2.7, numpy 1.5.1, gcc 4.4.1 #all compiled from source backtrace: gdb python (gdb) run -c 'import pylab;pylab.clf(); pylab.plot([4])' Starting program: python -c 'import pylab;pylab.clf(); pylab.plot([4])' [Thread debugging using libthread_db enabled] [New Thread 1 (LWP 1)] terminate called after throwing an instance of 'std::exception' terminate called recursively Program received signal SIGABRT, Aborted. [Switching to Thread 1 (LWP 1)] 0xfffffd7fff0ae88a in _lwp_kill () from /lib/64/libc.so.1 #0 0xfffffd7fff0ae88a in _lwp_kill () from /lib/64/libc.so.1 #1 0xfffffd7fff0a98b3 in thr_kill () from /lib/64/libc.so.1 #2 0xfffffd7fff0577e9 in raise () from /lib/64/libc.so.1 #3 0xfffffd7fff03a7d0 in abort () from /lib/64/libc.so.1 #4 0xfffffd7ff46d1a56 in __gnu_cxx::__verbose_terminate_handler () at ../../../../../libstdc++-v3/libsupc++/vterminate.cc:48 #5 0xfffffd7ff46cef6a in __cxxabiv1::__terminate (handler=0x1) at ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38 #6 0xfffffd7ff46cefb3 in std::terminate () at ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48 #7 0xfffffd7ff46cf03e in __cxxabiv1::__cxa_rethrow () at ../../../../../libstdc++-v3/libsupc++/eh_throw.cc:116 #8 0xfffffd7ff46d1af6 in __gnu_cxx::__verbose_terminate_handler () at ../../../../../libstdc++-v3/libsupc++/vterminate.cc:78 #9 0xfffffd7ff46cef6a in __cxxabiv1::__terminate (handler=0x1) at ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38 #10 0xfffffd7ff46cefb3 in std::terminate () at ../../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48 #11 0xfffffd7ff46cf0b6 in __cxxabiv1::__cxa_throw (obj=<value optimized out>, tinfo=<value optimized out>, dest=<value optimized out>) at ../../../../../libstdc++-v3/libsupc++/eh_throw.cc:83 #12 0xfffffd7ff4a22fd8 in py_to_agg_transformation_matrix (obj=0x774380, errors=<value optimized out>) at src/agg_py_transforms.cpp:22 #13 0xfffffd7ff4a32e7c in _path_module::update_path_extents (this=<value optimized out>, args=...) at src/path.cpp:380 #14 0xfffffd7ff4a34d90 in Py::ExtensionModule<_path_module>::invoke_method_varargs (this=<value optimized out>, method_def=<value optimized out>, args=...) at ./CXX/Python2/ExtensionModule.hxx:184 #15 0xfffffd7ff4a209b7 in Py::method_varargs_call_handler (_self_and_name_tuple=<value optimized out>, _args=<value optimized out>) at CXX/Python2/cxx_extensions.cxx:1714 #16 0x00000000004a6071 in call_function (f=0x2024770, throwflag=<value optimized out>) at /usr/local/src/lang/Python-2.7.1/Python/ceval.c:4012 #17 PyEval_EvalFrameEx (f=0x2024770, throwflag=<value optimized out>) at /usr/local/src/lang/Python-2.7.1/Python/ceval.c:2665 #18 0x00000000004a79c1 in PyEval_EvalCodeEx (co=0x124e230, globals=<value optimized out>, locals=<value optimized out>, args=0x2024910, argcount=<value optimized out>, kws=0x3, kwcount=2, defs=0x155c888, defcount=3, closure=0x0)
On Wed, Mar 9, 2011 at 8:25 PM, Andrew Chapkowski <ach...@es...>wrote: > Can someone please explain how to coordinates need to be passed to > contour for 3D graphs? I see all the examples use sample data, but I can't > find any information on how the input points need to be formatted. > Currently I have three array, one for the X, one for Y, and another for a Z > value, and I was to plot each set on a 3D contour graph. What do I need to > do to format these points correctly? > > > Thank you > > Andrew > > Andrew, The data input for contourf3d is pretty much the same as it is for regular 2-D contourf. Essentially, X and Y are the grid coordinates, while Z represents the value at those grid points. Z should be a NxM array. X and Y should be NxM, or X is length N, with Y being length M. I hope that clears it up. Ben Root
Can someone please explain how to coordinates need to be passed to contour for 3D graphs? I see all the examples use sample data, but I can't find any information on how the input points need to be formatted. Currently I have three array, one for the X, one for Y, and another for a Z value, and I was to plot each set on a 3D contour graph. What do I need to do to format these points correctly? Thank you Andrew
Hello, Can anyone show me how to change the default font used by Matplotlib in saving figures in EPS format? Thanks. I can change line "BitstreamVeraSans-Roman findfont" to "Helvetica findfont" in eps files to make the texts render correctly in Illustrator, but I don't want to do that every time. Regards, Bin
2011年3月9日 Luciano Fleischfresser <l_...@ya...>: > [...] > Does anybody know how to make the plot area start right at the > beginning of data and finish right at the end, so it spans the whole x axis? I think this should do the trick: axes.autoscale(axis='x', tight='True') Goyo
Hello, i am trying to make time series plots with the date on the x axis. The python code I managed to work read a .csv file with entries like Date-Time,T2am,T2 11-Fev-11-14:44:56,31.2,26.8 11-Fev-11-14:59:56,33,26.9 11-Fev-11-15:14:56,28.5,27... Here is the main part of the code datafile = ('t2vst2.csv') print 'loading', datafile times, temp1, temp2 = np.loadtxt( datafile, delimiter=',', converters={0:strpdate2num('%d-%b-%y-%H:%M:%S') }, skiprows=1, usecols=(0,1,2), unpack=True) fig = figure() ax = fig.add_subplot(111) ax.plot_date(times, temp1, 'r-',linewidth=2.0) ax.plot_date(times, temp2, 'g-',linewidth=2.0) ax.autoscale_view() ax.grid('True') ylabel('Temperatura em graus Celsius') fig.autofmt_xdate() show() Matplotlib chooses to plot starting on Feb 10 til Feb 20 when the data goes from Feb 11 to Feb 17. Does anybody know how to make the plot area start right at the beginning of data and finish right at the end, so it spans the whole x axis? Thanks in advance
On Wed, Mar 9, 2011 at 10:05 AM, Muffles <dan...@gm...> wrote: > > > > Benjamin Root-2 wrote: > > > > > > And, without the code, I can't help you. Please include a small script > > that > > I can run that demonstrates the problem. I can't reproduce your bug > based > > on your description. > > > > Ben Root > > > > > > Here it is, i think this works > > fig=figure(figsize=(5,9)) > > pcolor(rand(1000,60)) > > ax = fig.gca() > ax.set_yticks(np.arange(0, 1000, 100)) #define a legenda dos eixos > ax.set_yticklabels([0,1,2,3,4,5,6,7,8,9,10]) > plt.axis((0,60,0,1000)) #corta os eixos > > cax = axes([0.93, 0.1, 0.15, 0.8]) # setup colorbar axes > colorbar(cax=cax) # draw colorbar > > plt.show() > Try this. It is a lot cleaner: import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(5, 9)) ax = fig.gca() pc = ax.pcolor(np.random.rand(1000, 60)) ax.set_yticks(np.arange(0, 1000, 100)) ax.set_yticklabels(range(11)) ax.set_xlim(0, 60) ax.set_ylim(0, 1000) fig.colorbar(pc) plt.show() I hope that helps! Ben Root
You may use offsetbox module. Here is an complete example. Note that the circle always has a size of 25 point and also is draggable, Regards, -JJ import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import CirclePolygon, Circle x = np.arange(0, 10, 0.1) y = np.exp(-x/2.) * np.sin(2*np.pi*x) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, 'ro-', zorder=0) ax.set_xlim(0, 10) ax.set_ylim(-1, 1) # I want this circle to appear as a circle from matplotlib.offsetbox import DrawingArea, AnnotationBbox, DraggableAnnotation circle_radius = 25 # in points da = DrawingArea(width=2*circle_radius, height=2*circle_radius, xdescent=circle_radius, ydescent=circle_radius, clip=False) circle = Circle((0.,0.), radius=circle_radius, zorder=1, alpha=0.5) da.add_artist(circle) an1 = AnnotationBbox(da, xy=(7.5, 0.0), xycoords='data', frameon=False, pad=0., annotation_clip=False, box_alignment=(0.5, 0.5), ) ax.add_artist(an1) class DraggableAnn(DraggableAnnotation): def finalize_offset(self): loc_in_canvas = self.annotation.xytext self.annotation.textcoords = "data" pos_data = self.annotation.axes.transData.inverted().transform_point(loc_in_canvas) self.annotation.xytext = tuple(pos_data) drag1 = DraggableAnn(an1, use_blit=False) plt.show() On Wed, Mar 9, 2011 at 11:15 PM, Mads Ipsen <mad...@gm...> wrote: > I want the blue circle to appear as a circle with a 1:1 aspect ratio, making > it look like a circle and not an ellipse. Just like the scale free circles > making up the curve of the damped oscillationsn also shown in the plot. > > Preferably, the circle should also be scale free making it have the same > size no-matter how much the plot has been zoomed. > >
Benjamin Root-2 wrote: > > > And, without the code, I can't help you. Please include a small script > that > I can run that demonstrates the problem. I can't reproduce your bug based > on your description. > > Ben Root > > Here it is, i think this works fig=figure(figsize=(5,9)) pcolor(rand(1000,60)) ax = fig.gca() ax.set_yticks(np.arange(0, 1000, 100)) #define a legenda dos eixos ax.set_yticklabels([0,1,2,3,4,5,6,7,8,9,10]) plt.axis((0,60,0,1000)) #corta os eixos cax = axes([0.93, 0.1, 0.15, 0.8]) # setup colorbar axes colorbar(cax=cax) # draw colorbar plt.show() -- View this message in context: http://old.nabble.com/Many-basic-questions-i-cant-find-solution-tp31088840p31107693.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Wed, Mar 9, 2011 at 9:11 AM, Muffles <dan...@gm...> wrote: > > > > Benjamin Root-2 wrote: > > > > > > Could you please include your code? My code was merely a > > demonstration and not meant to be copy and pasted in it's entirety. > > > > Ben Root > > > > > > Thx, but I fixed that already, it was my error. > Still dont cant fix the width of the window though... > And, without the code, I can't help you. Please include a small script that I can run that demonstrates the problem. I can't reproduce your bug based on your description. Ben Root
2011年3月9日 hongleij <hon...@12...> > > Win7SP1/ActivePython-2.7.1.3-win32-x86 > matplotlib-1.0.1.win32-py2.7 from sourceforge > > I met the following with my dataset: > Save emf Error: too many values to uppack > Save pdf Error: Path lacks initial MOVETO > Save eps: No Erro ,but cann't open it. > > Here is the code : > > import cPickle > import matplotlib.pyplot as plt > from matplotlib import pylab > if __name__ == "__main__": > x_list =[19373.599999999999, 11022.120000000003, 90037.820000000007, \ > 57023.05000000001, 54658.360000000001, 50667.520000000004,\ > 37177.82, 165244.79000000001, 2575.2399999999998, > 2826.2399999999998] > y_list = [0.0, 1172.96, 83027.377499999988, 80505.191250000003, \ > 67571.089999999997, 16066.450000000001, 2806.2912500000002,\ > 108459.68750000004, 0.0, 5.0800000000000001] > myaxis = plt.gca() > myaxis.loglog([],[],linestyle='None') > myaxis.scatter(x_list,y_list,marker='x') > plt.xlim( 10,pow(10,7) ) > plt.ylim( 10,pow(10,8) ) > plt.show() > > I can confirm this bug (at least for eps and pdf files) on the master branch as well. I have also found that it occurs even for '+' markers and for 'o' markers. So, this problem isn't limited to just the AsteriskPolygonCollections. It appears to be something wrong with respect to utilizing the log scales. If I try the same code, but without log scale, the images are valid. Hong - just as a side note, using "loglog([], [], linestyle='None')" to force your graph into log scale is not the right way. It is better to do: myaxis.set_xscale('log') myaxis.set_yscale('log') This won't fix your problem, but at least it is better coding style. Ben Root
Thanks. The intention is to make the added circle dragable by the mouse by listening to mouse press, move, and release. That means that I have to modify the data of the added scatter data. I believe that the axes.scatter() method returns a matplotlib.collections.CircleCollection object. How do I change the position of the circles (one circle) contained in this object? Mads On 2011年03月09日 15:28, Benjamin Root wrote: > On Wednesday, March 9, 2011, Mads Ipsen<mad...@gm...> wrote: >> Hi, >> >> I am using the Qt4 based back engine for displaying a 2D plot in a >> widget. The plot typically contains lots of line plots. Suppose I add a >> CirclePolygon to the plot like this: >> >> circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', >> facecolor='red', zorder=1) >> axes.add_patch(circle) >> >> Then when I start to zoom in the window the aspect ratio of the circle >> is not preserved (it appears like an ellipse). If you plot a line with >> points, displaying its points using circles, these circles do have their >> aspect ratio (and size) preserved. There must be some approach for >> achieving the same effect for a manually added circle. >> >> Any help is appreciated, >> >> Best regards, >> >> Mads >> > Mads, > > The way this is done is tricky. The transform object assigned to the > circles in plot() and scatter() are different than the default when > you make a circle polygon yourself. The easiest way to get them is to > just simply use scatter() and pass in your own size value. > > I hope that helps! > Ben Root -- +--------------------------------------------------------------+ | Mads Ipsen, Scientific developer | +-------------------------------+------------------------------+ | QuantumWise A/S | phone: +45-29716388 | | Lersø Parkallé 107 | www: www.quantumwise.com | | DK-2100 Copenhagen Ø, Denmark | email: mad...@gm... | +-------------------------------+------------------------------+
Benjamin Root-2 wrote: > > > Could you please include your code? My code was merely a > demonstration and not meant to be copy and pasted in it's entirety. > > Ben Root > > Thx, but I fixed that already, it was my error. Still dont cant fix the width of the window though... -- View this message in context: http://old.nabble.com/Many-basic-questions-i-cant-find-solution-tp31088840p31107217.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Wednesday, March 9, 2011, Muffles <dan...@gm...> wrote: > > > > Benjamin Root-2 wrote: >> >> >> Note that will not change the number of ticks already established for the >> axis. For that, you can use set_xticks(), which accepts a list of values >> where to set the tick marks (you should probably use set_xticklabels() >> after >> set_xticks()). Note that you will need to have access to the axes object. >> For example: >> >> >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = fig.gca() # <--- the axes object I was talking about... >> ax.scatter([], []) >> ax.set_xticks([0.2, 0.4, 0.6, 0.8]) >> ax.set_xticklabels(['A', 'B', 'C', 'D']) >> plt.show() >> >> >> >> > > Well this just plots 2 different imagens now, one with only the axis, and > the other with the data and a default axis Could you please include your code? My code was merely a demonstration and not meant to be copy and pasted in it's entirety. Ben Root