[Matplotlib-users] Removing axes
Hi all, Thanks for the help so far. One more question - How do I completely remove the axes? I currently have a plot where a square hatching of lines is deformed to create a sky projection, so the square block of axes actually gets in the way. How do I remove it? Cheers Michael -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] using the symbol font in TeX plots
Hi all, To annotate my figures with Greek letters, I use the following: import matplotlib matplotlib.use('PDF') import matplotlib.pyplot as plt from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) plt.rcParams['ps.useafm'] = True rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) plt.rcParams['pdf.fonttype'] = 42 # plot figure # ... # annotate figure plt.xlabel(r'$\mu$ = 50') plt.ylabel(r'$\sigma$ = 1.5') This makes the equal symbol and everything to the right of it in the Helvetica font, as intended, and the Greek symbols default to the usual TeX font (which I believe is Times New Roman.) How can I make it so the font used for the Greek letters is the "Symbol" font instead? It's important for me not to have it appear in the default Times font of TeX. thanks for your help. -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] using the symbol font in TeX plots
per freem wrote: > Hi all, > > To annotate my figures with Greek letters, I use the following: > > import matplotlib > matplotlib.use('PDF') > import matplotlib.pyplot as plt > from matplotlib import rc > rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) > plt.rcParams['ps.useafm'] = True > rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) > plt.rcParams['pdf.fonttype'] = 42 > # plot figure > # ... > # annotate figure > plt.xlabel(r'$\mu$ = 50') > plt.ylabel(r'$\sigma$ = 1.5') > > This makes the equal symbol and everything to the right of it in the > Helvetica font, as intended, and the Greek symbols default to the > usual TeX font (which I believe is Times New Roman.) > > How can I make it so the font used for the Greek letters is the > "Symbol" font instead? It's important for me not to have it appear in > the default Times font of TeX. > There's information about changing the math font here: http://matplotlib.sourceforge.net/users/mathtext.html#fonts You may be able to use "Symbol" as a custom font, but this is untested, as far as I know. It would have to contain a Unicode mapping to be usable. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] png is clipped
Hi, I am trying to generate some pngs without using the GUI interface using the AGG backend. The problem is when I set figsize, the bottom part of the x-axis label is clipped. I am using python 2.5 in windows XP. I just installed the lastest version of matplotlib today version 0.98.3. Below is the code that produces two images that both have this problem. from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure fname1=r'C:\Documents and Settings\CCM\Desktop\test_plot1.png' fname2=r'C:\Documents and Settings\CCM\Desktop\test_plot2.png' fig = Figure(figsize=(4,3)) canvas = FigureCanvas(fig) ax = fig.add_subplot(111) ax.set_clip_box(None) ax.plot([1,2,3]) ax.set_title('hi mom') ax.grid(True) ax.set_xlabel('time') ax.set_ylabel('volts') print fig.get_size_inches() canvas.print_figure(fname1,dpi=200) fig.savefig(fname2) -- View this message in context: http://old.nabble.com/png-is-clipped-tp27327004p27327004.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] png is clipped
On Tue, Jan 26, 2010 at 12:00 PM, cwurld wrote: > > Hi, > > I am trying to generate some pngs without using the GUI interface using the > AGG backend. The problem is when I set figsize, the bottom part of the > x-axis label is clipped. I am using python 2.5 in windows XP. I just > installed the lastest version of matplotlib today version 0.98.3. Below is > the code that produces two images that both have this problem. Try setting fig.subplots_adjust(bottom=0.2) The default is 0.1 JDH -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Removing axes
You mean removing the the axes frame? subplot(111, frame_on=False) I'm sorry but it is not clear what you want. Regards, -JJ On Tue, Jan 26, 2010 at 4:18 AM, Michael Cohen wrote: > Hi all, > Thanks for the help so far. One more question - > How do I completely remove the axes? > I currently have a plot where a square hatching of lines is deformed to > create a sky projection, so the square block of axes actually gets in > the way. How do I remove it? > > Cheers > Michael > > -- > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] png is clipped
If you do not mind the output size slightly adjusted, try savefig("somename.png", bbox_inches="tight") Regards, -JJ On Tue, Jan 26, 2010 at 3:27 PM, John Hunter wrote: > On Tue, Jan 26, 2010 at 12:00 PM, cwurld wrote: >> >> Hi, >> >> I am trying to generate some pngs without using the GUI interface using the >> AGG backend. The problem is when I set figsize, the bottom part of the >> x-axis label is clipped. I am using python 2.5 in windows XP. I just >> installed the lastest version of matplotlib today version 0.98.3. Below is >> the code that produces two images that both have this problem. > > > Try setting > > fig.subplots_adjust(bottom=0.2) > > The default is 0.1 > > JDH > > -- > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Removing axes
There are a few ways to make ticks invisible. ax = subplot(111, frame_on=False) ax.xaxis.set_ticks_position("none") ax.yaxis.set_ticks_position("none") regards, -JJ On Tue, Jan 26, 2010 at 5:28 PM, Michael Cohen wrote: > Sorry, I should be clearer. > Inside the plot, I have made a shape, say a circle. > However, when I save it to eps, the circle is surrounded by a rectangular > box and tick marks, though I have managed to get the numbers that go with > those tick marks to stop showing up. > I am looking for a way to make the bounding rectangle with the tick marks > disappear. > What you suggest here does in fact remove the bounding rectangle. Now, how > can I get rid of the tick marks? > > Cheers > Michael > > On 01/26/2010 02:18 PM, Jae-Joon Lee wrote: >> >> You mean removing the the axes frame? >> >> subplot(111, frame_on=False) >> >> I'm sorry but it is not clear what you want. >> >> Regards, >> >> -JJ >> >> On Tue, Jan 26, 2010 at 4:18 AM, Michael Cohen wrote: >>> >>> Hi all, >>> Thanks for the help so far. One more question - >>> How do I completely remove the axes? >>> I currently have a plot where a square hatching of lines is deformed to >>> create a sky projection, so the square block of axes actually gets in >>> the way. How do I remove it? >>> >>> Cheers >>> Michael >>> >>> >>> -- >>> The Planet: dedicated and managed hosting, cloud storage, colocation >>> Stay online with enterprise data centers and the best network in the >>> business >>> Choose flexible plans and management services without long-term contracts >>> Personal 24x7 support from experience hosting pros just a phone call >>> away. >>> http://p.sf.net/sfu/theplanet-com >>> ___ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> > > -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] mplot3d bar3d errors
Hi all, I'm getting strange errors trying to use the bar3d method in mplot3d (I'm using matplotlib 0.99.0 in Ubuntu 9.10 and Python 2.6). I'm doing something roughly like the example at http://matplotlib.sourceforge.net/examples/mplot3d/hist3d_demo.html I've pasted my sample program below, which has 2 cases: In case 1, you see just what you would expect: 2 rows of bars with increasing size in the y direction. if you uncomment case 2 (for different bar heights), you get the following error: Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py", line 352, in expose_event self._render_figure(self._pixmap, w, h) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure FigureCanvasAgg.draw(self) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line 314, in draw self.figure.draw(self.renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 774, in draw for a in self.axes: a.draw(renderer) File "/usr/lib/pymodules/python2.6/mpl_toolkits/mplot3d/axes3d.py", line 135, in draw for col in self.collections] File "/usr/lib/pymodules/python2.6/mpl_toolkits/mplot3d/art3d.py", line 334, in do_3d_projection z_segments_2d.sort(reverse=True) ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() This error gets thrown any time the 2 bars in the same y position have exactly the same z value: in the sample program the (0,0) value and (0,1) value are both 1 but it works for any of the 4 pairs. The error is particularly confusing. even looking at the source of the sort line in the backtrace, it's not clear where any arrays are being used as truth values. (just compared for the sort). This can be worked around by adding a tiny delta to the z values in one of the rows: it only errors when the corresponding z values match exactly. Am I doing something wrong here? or is this some kind of bug in the drawing code? thanks, -Derek the program: #!/usr/bin/env python2.6 import matplotlib.pyplot as plot import mpl_toolkits.mplot3d import numpy fig2 = plot.figure() ax2 = mpl_toolkits.mplot3d.Axes3D(fig2) xpos = numpy.asarray([0, 1, 2, 4, 0, 1, 2, 4]) ypos = numpy.asarray([0, 0, 0, 0, 1, 1, 1, 1]) zpos = numpy.zeros_like(xpos) dx = 0.05 * numpy.ones_like(zpos) dy = numpy.ones_like(zpos) #case 1 dz = numpy.asarray([1,2,3,4,5,6,7,8]) #case 2 #dz = numpy.asarray([1,2,3,4,1,6,7,8]) ax2.bar3d(ypos, xpos, zpos, dy, dx, dz, color='b') ax2.set_xlabel('X') ax2.set_ylabel('Y') ax2.set_zlabel('Z') plot.show() -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] png is clipped
Jae-Joon Lee wrote: > > savefig("somename.png", bbox_inches="tight") > I tried it and it did NOT solve the problem. The "fig.subplots_adjust(bottom=0.2)" solution did solve the problem. -- View this message in context: http://old.nabble.com/png-is-clipped-tp27327004p27333507.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] positioning an inset_axes precisely in the figure
hi all, i am using mpl_toolkits.axes_grid.inset_locator.inset_axes to plot an inset axes inside my figure, as follows: inset = inset_axes(s, width="30%", # width = 30% of parent_bbox height=.5, # height : 1 inch loc=4 ) i am trying to use the bbox_transform keyword argument to reposition this within the figure -- i want to use figure coordinates rather than the loc= keyword. if i try the following: inset = inset_axes(s, width="30%", # width = 30% of parent_bbox height=.5, # height : 1 inch bbox_transform=(0.1, 0.1)) then i get the error: File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/offsetbox.py", line 910, in get_bbox_to_anchor transform) File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/transforms.py", line 974, in __init__ assert isinstance(transform, Transform) AssertionError any idea how i can reposition the inset axes? thanks very much for your help. -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] png is clipped
Another way to solve this problem is to not use the figsize keyword when creating the Figure. Instead only adjust the dpi. For example: w,h=fig.get_size_inches() target_width_pix=300 dpi=target_width_pix/w canvas.print_figure(fname1,dpi=dpi) -- View this message in context: http://old.nabble.com/png-is-clipped-tp27327004p27333529.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] positioning an inset_axes precisely in the figure
*bbox_transform* expects a Transform instance. ax = subplot(111) ax2 = inset_axes(ax, width=3, height=2, loc=3, bbox_to_anchor=(0.1, 0.1), bbox_transform=ax.figure.transFigure) Note that, bbox_to_anchor with a tuple of two numbers creates a bbox with width=height=0, and something like width="30%" won't work. Regards, -JJ > > i am using mpl_toolkits.axes_grid.inset_locator.inset_axes to plot an > inset axes inside my figure, as follows: > > inset = inset_axes(s, > width="30%", # width = 30% of parent_bbox > height=.5, # height : 1 inch > loc=4 > ) > > i am trying to use the bbox_transform keyword argument to reposition > this within the figure -- i want to use figure coordinates rather than > the loc= keyword. > > if i try the following: > > inset = inset_axes(s, > width="30%", # width = 30% of parent_bbox > height=.5, # height : 1 inch > bbox_transform=(0.1, 0.1)) > > then i get the error: > > File > "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/offsetbox.py", > line 910, in get_bbox_to_anchor > transform) > File > "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/transforms.py", > line 974, in __init__ > assert isinstance(transform, Transform) > AssertionError > > any idea how i can reposition the inset axes? thanks very much for your help. > > -- > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Removing axes
Great, that worked. Michael On 1/26/2010 2:35 PM, Jae-Joon Lee wrote: > There are a few ways to make ticks invisible. > > ax = subplot(111, frame_on=False) > ax.xaxis.set_ticks_position("none") > ax.yaxis.set_ticks_position("none") > > regards, > > -JJ > > > On Tue, Jan 26, 2010 at 5:28 PM, Michael Cohen wrote: >> Sorry, I should be clearer. >> Inside the plot, I have made a shape, say a circle. >> However, when I save it to eps, the circle is surrounded by a rectangular >> box and tick marks, though I have managed to get the numbers that go with >> those tick marks to stop showing up. >> I am looking for a way to make the bounding rectangle with the tick marks >> disappear. >> What you suggest here does in fact remove the bounding rectangle. Now, how >> can I get rid of the tick marks? >> >> Cheers >> Michael >> >> On 01/26/2010 02:18 PM, Jae-Joon Lee wrote: >>> >>> You mean removing the the axes frame? >>> >>>subplot(111, frame_on=False) >>> >>> I'm sorry but it is not clear what you want. >>> >>> Regards, >>> >>> -JJ >>> >>> On Tue, Jan 26, 2010 at 4:18 AM, Michael Cohenwrote: Hi all, Thanks for the help so far. One more question - How do I completely remove the axes? I currently have a plot where a square hatching of lines is deformed to create a sky projection, so the square block of axes actually gets in the way. How do I remove it? Cheers Michael -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users