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
(6) |
2
(29) |
3
(19) |
4
(6) |
5
(5) |
6
(9) |
7
(9) |
8
(19) |
9
(14) |
10
(19) |
11
(26) |
12
(10) |
13
(26) |
14
(22) |
15
(19) |
16
(17) |
17
(16) |
18
(2) |
19
|
20
(1) |
21
(1) |
22
(10) |
23
(11) |
24
(17) |
25
(6) |
26
(1) |
27
|
28
(9) |
29
(9) |
30
(9) |
|
|
|
From: Grigoris M. <gr....@gm...> - 2011-11-30 23:31:48
|
Well I did tried this but it didn't work out. It actually removes the black color from the color_cycle but the pie still prints it. Moreover I noticed that this color_cycle has 7 colors that repeats after the first 7 so it won't do what I want. I will need to find another way to set the colors or just avoid the pie. Thanks though for the help! Regards Grigoris On 11/30/2011 06:09 PM, Tony Yu wrote: > On Wed, Nov 30, 2011 at 10:34 AM, Grigoris Maravelias > <gr....@gm... <mailto:gr....@gm...>> wrote: > > Hello list! > > I have a question regarding the colors of the pie diagram of > matplotlib. When no colors are assigned then the pie function > automatically selects some colors, like the example image I have > attached. But in this case the black color covers the text. How > can we avoid this?Is there an easy (perhaps?) way to exclude a color? > > > I don't really use pie charts, but I think it just uses the default > color cycle. This can be altered by changing the rcParams: > > >>> import matplotlib.pyplot as plt > >>> plt.rcParams['axes.color_cycle'].remove('k') > > The color_cycle parameter is just a python list, so I use list.remove > to remove black (which is the letter 'k' since 'b' is blue). There are > other ways of setting rcParams, as detailed in the help files > <http://matplotlib.sourceforge.net/users/customizing.html> (Note that > `rc` and `rcParams` is in both matplotlib.pyplot and the main > matplotlib package). > > Best, > -Tony |
From: Tony Yu <ts...@gm...> - 2011-11-30 18:45:16
|
On Wed, Nov 30, 2011 at 11:42 AM, Jeffrey Blackburne < jbl...@al...> wrote: > Hi Steven, > > Try this: > > import numpy as np > import numpy.random > import matplotlib as mpl > import matplotlib.pyplot as plt > > x = np.random.randn(1000) > h, binedg = np.histogram(x, 10) > > wid = binedg[1:] - binedg[:-1] > plt.bar(binedg[:-1], h/float(x.size), width=wid) > > > On Nov 30, 2011, at 10:25 AM, Steven Boada wrote: > > > Hi Users, > > > > I'm looking to make a histogram that is normalized by the total number > > of items shown in the histogram. For example: > > > > Let's say that I have an array 1000 items long. If I make a > > histogram in > > the normal way hist(x,10) then I get a histogram showing the total > > number of items in each bin. What I want to do is take that total > > number > > in each bin and divide them by 1000 and then make the plot. > > > > So if one of my bins has 350 objects in it, then it would be > > changed to > > 0.35. > > > > Another way to say it would be that I want the height of the histogram > > to represent the fraction of the total. I am pretty sure that this is > > different than using the "normed=True" flag, but I couldn't find > > anyone > > talking about this when I searched. > > > > Thanks > > > > Steven > > One option: You can plot the normal `hist` and then change the tick labels appropriately. Here's some code for accomplishing that: #~~~ import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter, MultipleLocator N = 350 ytick_step = 0.05 data = np.random.normal(size=N) def norm_num(x, pos): return '%g' % (x / float(N)) locator = MultipleLocator(N * ytick_step) formatter = FuncFormatter(norm_num) f, ax = plt.subplots() ax.yaxis.set_major_formatter(formatter) ax.yaxis.set_major_locator(locator) ax.hist(data) plt.show() #~~~ Note that the formatter object is all you need to change to the desired scale. But, that result will usually look ugly, because you'll get tick labels with long, ugly floating point numbers. The locator object fixes that issue. Best, -Tony |
From: Jeffrey B. <jbl...@al...> - 2011-11-30 16:42:08
|
Hi Steven, Try this: import numpy as np import numpy.random import matplotlib as mpl import matplotlib.pyplot as plt x = np.random.randn(1000) h, binedg = np.histogram(x, 10) wid = binedg[1:] - binedg[:-1] plt.bar(binedg[:-1], h/float(x.size), width=wid) On Nov 30, 2011, at 10:25 AM, Steven Boada wrote: > Hi Users, > > I'm looking to make a histogram that is normalized by the total number > of items shown in the histogram. For example: > > Let's say that I have an array 1000 items long. If I make a > histogram in > the normal way hist(x,10) then I get a histogram showing the total > number of items in each bin. What I want to do is take that total > number > in each bin and divide them by 1000 and then make the plot. > > So if one of my bins has 350 objects in it, then it would be > changed to > 0.35. > > Another way to say it would be that I want the height of the histogram > to represent the fraction of the total. I am pretty sure that this is > different than using the "normed=True" flag, but I couldn't find > anyone > talking about this when I searched. > > Thanks > > Steven > > > ---------------------------------------------------------------------- > -------- > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Tony Yu <ts...@gm...> - 2011-11-30 16:09:20
|
On Wed, Nov 30, 2011 at 10:34 AM, Grigoris Maravelias < gr....@gm...> wrote: > Hello list! > > I have a question regarding the colors of the pie diagram of matplotlib. > When no colors are assigned then the pie function automatically selects > some colors, like the example image I have attached. But in this case the > black color covers the text. How can we avoid this?Is there an easy > (perhaps?) way to exclude a color? > I don't really use pie charts, but I think it just uses the default color cycle. This can be altered by changing the rcParams: >>> import matplotlib.pyplot as plt >>> plt.rcParams['axes.color_cycle'].remove('k') The color_cycle parameter is just a python list, so I use list.remove to remove black (which is the letter 'k' since 'b' is blue). There are other ways of setting rcParams, as detailed in the help files<http://matplotlib.sourceforge.net/users/customizing.html>(Note that `rc` and `rcParams` is in both matplotlib.pyplot and the main matplotlib package). Best, -Tony |
From: Yoshi R. <yo...@ro...> - 2011-11-30 16:01:37
|
i use something like that: from datetime import datetime, timedelta import matplotlib.pyplot as pl import matplotlib.ticker as ticker import matplotlib.dates as mdates dates1 = [datetime(2005,5,11)+n*timedelta(days=1) for n in range(500)] dates2 = [datetime(... ax1 = pl.subplot(2,1,1) ax1.plot(dates1, y1, 'r') ax1.fmt_xdata = mdates.DateFormatter('%Y-%m-%d') ax2 = pl.subplot(2,1,2) ax2.plot(dates2, ... that's what you want? regards, yoshi |
From: Grigoris M. <gr....@gm...> - 2011-11-30 15:34:54
|
Hello list! I have a question regarding the colors of the pie diagram of matplotlib. When no colors are assigned then the pie function automatically selects some colors, like the example image I have attached. But in this case the black color covers the text. How can we avoid this?Is there an easy (perhaps?) way to exclude a color? Of course there is not problem if I specifically select the colors but I do not know how many parts exist beforehand (and I would like to assign it automatically). Thanks! Regards Grigoris |
From: Steven B. <bo...@ph...> - 2011-11-30 15:25:36
|
Hi Users, I'm looking to make a histogram that is normalized by the total number of items shown in the histogram. For example: Let's say that I have an array 1000 items long. If I make a histogram in the normal way hist(x,10) then I get a histogram showing the total number of items in each bin. What I want to do is take that total number in each bin and divide them by 1000 and then make the plot. So if one of my bins has 350 objects in it, then it would be changed to 0.35. Another way to say it would be that I want the height of the histogram to represent the fraction of the total. I am pretty sure that this is different than using the "normed=True" flag, but I couldn't find anyone talking about this when I searched. Thanks Steven |
From: Ed M. <em...@en...> - 2011-11-30 11:01:59
|
I have a short script to plot 20 years of river flow data. I can use the plot_date command to create a plot, using this snippet: f = figure() ax1 = f.add_subplot(111) ax1.plot_date(dates0,y1,'g', label='observed', xdate=True,visible=True) ax1.plot_date(dates1,y2,'r', label='simulated', xdate=True,visible=True) years = YearLocator(1, month=6, day=30) # every year months = MonthLocator(1) # every month ax1.set_xlim(date2num(datetime.date(1990,1,1)),date2num(datetime.date(1999,12,31))) ax1.xaxis.set_major_locator(years) ax1.xaxis.set_minor_locator(months) labels = ax1.get_xticklabels() setp(labels, fontsize=8,visible=True) The problem is with the x-axis (time axis) labels when I add a second subplot, to add the next time segment. I change the above to ax1 = f.add_subplot(211), and then: ax2 = f.add_subplot(212) ax2.plot_date(dates0,y1,'g') #plots the time series ax2.plot_date(dates1,y2,'r') #need to call twice, unlike plot, plot_date takes one set ax2.set_xlim(date2num(datetime.date(2000,1,1)),date2num(datetime.date(2009,12,31))) ax2.xaxis.set_major_locator(years) ax2.xaxis.set_minor_locator(months) setp(labels, fontsize=8,visible=True) The x-axis labels only appear for the last subplot. I'm guessing that plot_date assumes that more than one subplot must share a time axis. There must be a simple way to stop plot_date from doing this, if this is indeed the problem. Any guidance would be appreciated. Thanks, Ed |
From: Jae-Joon L. <lee...@gm...> - 2011-11-30 06:58:16
|
On Mon, Nov 28, 2011 at 10:49 PM, Jae-Joon Lee <lee...@gm...> wrote: > This is a bug. In the current implementation, "annotate" has a > side-effect that modifies the arrowprops dictionary. For a future reference, this should now be fixed in the v1.1.x branch which also has been merged into the master branch. https://github.com/matplotlib/matplotlib/commit/b3a2ab77c89fdb3ab860edeb1a781b5307347070 Regards, -JJ |
From: Eric F. <ef...@ha...> - 2011-11-29 23:46:28
|
On 11/29/2011 01:29 PM, Nat Echols wrote: > I'm plotting values that cover a very small range with a relatively > large base, e.g. > > 375.0001 > 375.00025 > 375.0002 > ... > > In practice, the data series hovers at a single value for several > hundred elements in a row, then fluctuates slightly. Initially > matplotlib does what I expect, and the Y-axis ticks are labeled 373, > 374, 376, 376, etc. Once the small fluctuations are plotted, however, > it switches to showing relative values, with the absolute reference > point above the plot, as in the attached image. This is needlessly > confusing - is there a way to prevent such behavior? > > thanks, > Nat If you are using mpl 1.0 or later, try pyplot.ticklabel_format(useOffset=False) It is also available as an Axes method. Eric > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Nat E. <nat...@gm...> - 2011-11-29 23:29:19
|
I'm plotting values that cover a very small range with a relatively large base, e.g. 375.0001 375.00025 375.0002 ... In practice, the data series hovers at a single value for several hundred elements in a row, then fluctuates slightly. Initially matplotlib does what I expect, and the Y-axis ticks are labeled 373, 374, 376, 376, etc. Once the small fluctuations are plotted, however, it switches to showing relative values, with the absolute reference point above the plot, as in the attached image. This is needlessly confusing - is there a way to prevent such behavior? thanks, Nat |
From: Molly S. <msw...@cf...> - 2011-11-29 22:38:57
|
I would like to suggest the following fixes for the mpl_toolkits.basemap module to improve its treatment of celestial (rather than geographic) coordinates. The first one, posted at https://github.com/mollyswanson/basemap/commit/23db4bbebf4d7fe6ca202b5dad50b6a2054dd685 changes the call function in basemap's init.py to correctly transform lat/lon values into xy map coordinates in the case of a cyclic or polycyclic projection with lon_0 not equal to 0. The second, posted at https://github.com/mollyswanson/basemap/commit/35470b51523e9429d26cefc911dca843264581b9 changes one line in the drawparallels. This line is to avoid drawing lines between points on the parallel that span the whole map. However, the old version uses a fixed value for the distance between the points rather than scaling it to the radius of the sphere used in the projection, so if you use a non-default radius (such as 180/pi, so your x-y values are in degrees on the sky instead of meters on the earth) it won't work. This fix scales the cutoff value to the radius of the projection sphere. The following example illustrates the issues that are addressed here: from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt figure(1) #make a basemap centered on longitude of 90 m=Basemap(celestial=False,lon_0=90,projection='hammer') #draw map boundary and grid m.drawmapboundary() m.drawparallels(np.arange(-90.,91.,30.),labels=[1,0,0,0]) m.drawmeridians(np.arange(-90.,271.,30.),labels=[0,0,0,0]) #define a test polygon - a triangle with corners at [lon,lat]=[90,30],[120,60],[120,30] polygon=array([[90,30],[120,60],[120,30],[90,30]]) #convert to map coordinates polyxy=m(polygon[:,0],polygon[:,1]) plt.plot(polyxy[0],polyxy[1]) plt.savefig('basemap1.png') figure(2) #make a celestial basemap centered on longitude of 90 m=Basemap(celestial=True,lon_0=90,projection='hammer',rsphere=180./pi) #draw map boundary and grid m.drawmapboundary() m.drawparallels(np.arange(-90.,91.,30.),labels=[1,0,0,0]) m.drawmeridians(np.arange(-90.,271.,30.),labels=[0,0,0,0]) #define a test polygon - a triangle with corners at [lon,lat]=[90,30],[120,60],[120,30] polygon=array([[90,30],[120,60],[120,30],[90,30]]) #convert to map coordinates polyxy=m(polygon[:,0],polygon[:,1]) plt.plot(polyxy[0],polyxy[1]) plt.savefig('celestial_basemap1.png') Thank you! Molly Swanson |
From: Ed M. <ed....@gm...> - 2011-11-29 21:20:33
|
I have a short script to plot 20 years of river flow data. I can use the plot_date command to create a plot, using this snippet: f = figure() ax1 = f.add_subplot(111) ax1.plot_date(dates0,y1,'g', label='observed', xdate=True,visible=True) ax1.plot_date(dates1,y2,'r', label='simulated', xdate=True,visible=True) years = YearLocator(1, month=6, day=30) # every year months = MonthLocator(1) # every month ax1.set_xlim(date2num(datetime.date(1990,1,1)),date2num(datetime.date(1999,12,31))) ax1.xaxis.set_major_locator(years) ax1.xaxis.set_minor_locator(months) labels = ax1.get_xticklabels() setp(labels, fontsize=8,visible=True) The problem is with the x-axis (time axis) labels when I add a second subplot, to add the next time segment. I change the above to ax1 = f.add_subplot(211), and then: ax2 = f.add_subplot(212) ax2.plot_date(dates0,y1,'g') #plots the time series ax2.plot_date(dates1,y2,'r') #need to call twice, unlike plot, plot_date takes one set ax2.set_xlim(date2num(datetime.date(2000,1,1)),date2num(datetime.date(2009,12,31))) ax2.xaxis.set_major_locator(years) ax2.xaxis.set_minor_locator(months) setp(labels, fontsize=8,visible=True) The x-axis labels only appear for the last subplot. I'm guessing that plot_date assumes that more than one subplot must share a time axis. There must be a simple way to stop plot_date from doing this, if this is indeed the problem. Any guidance would be appreciated. Thanks, Ed |
From: Neil B. <nb...@at...> - 2011-11-29 21:17:02
|
Hello all, I am struggling to improve the layout of these subplots. You can see that the x tick labels on the left subplot are crunched. I simply want to stretch the x axis a bit in order to spread out the x ticks. Do you have any suggestions? Thanks! Neil ----- Here is my code: P.figure() P.subplots_adjust(wspace=0.4) P.subplot(121) P.hist([el_mean_diff,ln_mean_diff],bins=[-.7,-.6,-.5,-.4,-.3,-.2,-.1,0,.1,.2,.3,.4,.5,.6,.7],color=['red','blue'],align='mid') P.title('a) mean') P.xlabel('Average difference at each grid point (m/s) ') P.ylabel('Number of grid points') P.tick_params(axis='both',direction='out',top='off',right='off',length=2,labelsize='10') P.grid(True) P.subplot(122) P.hist([el_stdv_diff,ln_stdv_diff],bins=[-.5,-.4,-.3,-.2,-.1,0,.1,.2,.3,.4,.5],color=['red','blue'],align='mid') P.title('b) standard deviation') P.xlabel('Average difference at each grid point (m/s) ') P.ylabel('Number of grid points') P.tick_params(axis='both',direction='out',top='off',right='off',length=2,labelsize='10') P.grid(True) P.show() ---- |
From: Ryan M. <rm...@gm...> - 2011-11-29 15:06:14
|
On Tue, Nov 29, 2011 at 4:16 AM, Fabien Lafont <laf...@gm...> wrote: > Hello everyone, > > I don't understand how works TimerBase. > > > > >From matplotlib import backend_bases > > def write(x): > print x > > backend_bases.TimerBase._timer_start > backend_bases.TimerBase(1000,write(2)) TimerBase is a do-nothing skeleton class that provides the common infrastructure for other backends to implement a timer that works with them (just like the rest of backend_bases). For example, the gtk backend uses this as a starting point for its own timer class. You really shouldn't be instantiating TimerBase yourself as it won't do anything. > It returns only "2" one time. Why it doesn't return 2 every second? The only reason you actually see anything at all is because you call write yourself when you do: write(2) The timer never actually does anything. The proper call is to separate the function and its arguments, since as the docs say, it takes a "list of (func, args) tuples that will be called upon timer events": TimerBase(1000, [(write, 2)]) However, the proper way to create a timer, which will intergrate properly with the figure event loop, is shown in the example: http://matplotlib.sourceforge.net/examples/event_handling/timers.html In your case: timer = fig.canvas.new_timer(interval=1000) timer.add_callback(write, 2) timer.start() Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
From: Fabien L. <laf...@gm...> - 2011-11-29 10:16:44
|
Hello everyone, I don't understand how works TimerBase. >From matplotlib import backend_bases def write(x): print x backend_bases.TimerBase._timer_start backend_bases.TimerBase(1000,write(2)) It returns only "2" one time. Why it doesn't return 2 every second? Thx in advance, Fabien |
From: Markus B. <mar...@gm...> - 2011-11-29 02:09:23
|
> This is a bug. In the current implementation, "annotate" has a > side-effect that modifies the arrowprops dictionary. > As a workaround, you may do, > > arrowprops = dict(arrowstyle='-', relpos=(0, 1)) > plt.annotate('Good relpos', (3, 3), xytext = (3, 2), > annotation_clip=False, arrowprops=arrowprops.copy()) > > Works for me. Thanks a lot! > > > plt.annotate('No ha/va', (5, 5), xytext = (5, 4), > > arrowprops=dict(arrowstyle='-'), > > ha='left', va='top') > > > > ha and va controls the location of the text relative to the xytext, > and I believe it does work as expected. It has nothing to do with the > starting point of the arrow, which should be controlled by the relpos > parameter. > Thanks for clarifying. Regards, Markus |
From: Austin G. <au...@as...> - 2011-11-29 01:59:46
|
Hello, Are there examples of extending imshow or further customizing any of the UI components of matpotlib? Or anything you can point me at to get started? I have been able to connect events to imshow. An example of the type of thing I might want to do is to print the R,G,B value in a status bar when I hover over an x y coordinate of an image. -- Austin Godber |
From: C M <cmp...@gm...> - 2011-11-28 20:45:41
|
As related to another question(s) I've posted, can someone help with this custom formatter? This is for use in a FunctionFormatter to be used on the y axis to format the ticks (in particular, to remove them when not wanted). Example: def CustomFormatter(self,y,i): if y < 0: return '' This says if the value of y < 0, put nothing on the axis tick. QUESTION: How can I implement the following two sorts of rules in Matplotlib's (OO) API? def CustomFormatter(self,y,i): if y falls in the bottom 50 pixels' worth of height of this plot: return '' or def CustomFormatter(self,y,i): if y falls in the bottom 10% of the height of this plot: return '' Thanks, Che |
From: Shankararaman R. <Sha...@Tr...> - 2011-11-28 20:04:04
|
Hello, I am fairly new to Matplotlib and appreciate your help with my question: I am looking to generate a time series trend plots and include as my xtick labels a selective list of strings. For ex: Month/Year label for data corresponding to the 1st day of each month. I may be plotting 365 days of data but want to show only 12 xtick labels. Would it be possible to specify grid lines for every 7 days of data for instance? This makes the grid line locations different from the xtick label locations. I am sure there is support for such a feature in Matplotlib. I did look through the docs/forums but could not find much help. Any suggestions will be much appreciated. Thanks, Shankar |
From: Sterling S. <sm...@fu...> - 2011-11-28 19:40:50
|
> > From: "Marianne C." <mar...@gm...> > Date: November 24, 2011 6:48:34 AM PST > To: mat...@li... > Subject: [Matplotlib-users] Removing ticks and frame (imshow) > > > Hi all, > > My name is Marianne, I am a beginner user of matplotlib. > I am using imshow in pyplot. I am desperate to get rid of > the ticks on both x and y axes (see attached picture). I > do not need the black box around the data either. Should > I use imshow in axes.Axes instead, to be able to call > set_ticks_position("none")? > Thank you for your help, > Marianne > > Here is the code so far: > > import numpy > from matplotlib import pyplot > > q=numpy.loadtxt('field.txt') > > myfield = pyplot.imshow(q,aspect=1) > myfield.set_clim(vmin=0, vmax=0.6) > > pyplot.colorbar() > > pyplot.savefig('field_1.eps') > > <field_1.pdf> Marianne, Try myfield.get_axes().axis('off') -Sterling |
From: Tony Yu <ts...@gm...> - 2011-11-28 16:09:53
|
On Thu, Nov 24, 2011 at 9:48 AM, Marianne C. <mar...@gm...> wrote: > Hi all, > > My name is Marianne, I am a beginner user of matplotlib. > I am using imshow in pyplot. I am desperate to get rid of > the ticks on both x and y axes (see attached picture). I > do not need the black box around the data either. Should > I use imshow in axes.Axes instead, to be able to call > > set_ticks_position("none")? > > Thank you for your help, > Marianne > > Here is the code so far: > > import numpy > from matplotlib import pyplot > > q=numpy.loadtxt('field.txt') > > myfield = pyplot.imshow(q,aspect=1) > myfield.set_clim(vmin=0, vmax=0.6) > > pyplot.colorbar() > > pyplot.savefig('field_1.eps') > There are a number of ways to accomplish this, but the one I use is to make the x and y axes invisible (gets rid of the ticks) and also make the spines invisible (gets rid of the lines). I just throw these changes into a utility function (`clear_frame` below) and put that in a module that's on my python path so that it's easily reusable. Hope that helps, -Tony #~~~ import numpy as np import matplotlib.pyplot as plt def clear_frame(ax=None): if ax is None: ax = plt.gca() ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) for spine in ax.spines.itervalues(): spine.set_visible(False) img = np.random.random((100,100)) plt.imshow(img) clear_frame() plt.colorbar() plt.show() #~~~ |
From: Jeff W. <js...@fa...> - 2011-11-28 15:52:20
|
On 11/22/11 12:51 PM, Dave Xia wrote: > Hi, > > I am a new user of matplotlib Basemap. I tried to draw the latitude > with interval 0.1 degree using drawparallels, but failed. I wonder if > the drawparallels can draw latitude lines with small interval instead > of integer values. (drawmeridian can work with small interval 0.1). > > Does anyone have any idea to fix this issue? > > Thanks! > > Dave Confirmed. This is now fixed in github master. It's a one-liner, so you can manually patch your source if you prefer. Just change line 2067 in lib/mpl_toolkits/basemap/__init__.py from if t is not None: linecolls[int(lat)][1].append(t) to if t is not None: linecolls[lat][1].append(t) Regards, Jeff |
From: Jae-Joon L. <lee...@gm...> - 2011-11-28 13:50:20
|
On Mon, Nov 28, 2011 at 9:39 PM, Markus Baden <mar...@gm...> wrote: > anno_args = { > 'annotation_clip': False, > 'arrowprops': dict(arrowstyle='-', relpos=(0, 1)), > } > plt.annotate('Good relpos', (3, 3), xytext = (3, 2), **anno_args) > plt.annotate('Bad relpos', (6, 6), xytext = (6, 5), **anno_args) This is a bug. In the current implementation, "annotate" has a side-effect that modifies the arrowprops dictionary. As a workaround, you may do, arrowprops = dict(arrowstyle='-', relpos=(0, 1)) plt.annotate('Good relpos', (3, 3), xytext = (3, 2), annotation_clip=False, arrowprops=arrowprops.copy()) > plt.annotate('No ha/va', (5, 5), xytext = (5, 4), > arrowprops=dict(arrowstyle='-'), > ha='left', va='top') > ha and va controls the location of the text relative to the xytext, and I believe it does work as expected. It has nothing to do with the starting point of the arrow, which should be controlled by the relpos parameter. Regards, -JJ |
From: Markus B. <mar...@gm...> - 2011-11-28 12:39:23
|
Hi list, I'm trying to annotate points on a graph by drawing a simple line from the point on the axis to the top left corner of the text. I can't figure out, how to use pyplot.annotate so that it turns of the arrow head and I can use horizontalalignment (ha) and verticalalignment (va). When I use arrowstyle='-' in the arrowprops dictionary ha and va don't work. Instead I use relpos=(0, 1) in the arrowprops dictionary, which works, but only when I call the annotate function the first time. Below is a minimal example. I'm using mpl version 1.0. as part of EPD 7.1 on Mac OS X 10.5. Any hints on how to achieve my goal would be greatly appreciated! Best regards, Markus --- The following code reproduces my problem import numpy as np import matplotlib.pyplot as plt data = np.linspace(1,10) plt.plot(data, data) anno_args = { 'annotation_clip': False, 'arrowprops': dict(arrowstyle='-', relpos=(0, 1)), } plt.annotate('Good relpos', (3, 3), xytext = (3, 2), **anno_args) plt.annotate('Bad relpos', (6, 6), xytext = (6, 5), **anno_args) plt.annotate('No ha/va', (5, 5), xytext = (5, 4), arrowprops=dict(arrowstyle='-'), ha='left', va='top') plt.show() |