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



Showing 10 results of 10

From: Damon M. <dam...@gm...> - 2012年10月30日 23:13:22
On Tuesday, October 30, 2012, Russell E. Owen wrote:
> In article <508...@st... <javascript:;>>,
> Michael Droettboom <md...@st... <javascript:;>>
> wrote:
>
> > Agreed! Thanks to everyone for their hard work. I think this has
> > shaped up to be a great release.
> >
> > I'm fortunate to have power and connectivity today, so I was able to get
> > a release tested, tagged and uploaded.
> >
> > To our binary builders: as able, it would be great to put the binaries
> > up (or send them to me to do so), and then I'll make an announcement on
> > matplotlib-users. I really intend (barring any really serious issues)
> > this to be the last rc before the 1.2.0 final.
> >
> > Thanks again,
> > Mike
>
> The Mac binaries are now up. This time it built perfectly on MacOS X
> 10.4; thanks to the folks that worked so hard fixing those build
> problems.
>
> The 32-bit version is not well tested because I have neither inkscape
> nor ghostscript installed on that ancient system, but it passes the
> tests that it can run under those circumstances.
>
> The 64-bit version passes all tests except 2 knownfail and 3 skipped.
>
> -- Russell
>
> P.S. I had to build the 64-bit version twice. The first time I tried to
> build it using the same directory of code that I used to build 32-bit
> version. I first deleted the "build" and "dist" subdirectories and ran
> "python setup.py clean", then built as usual. There were no errors or
> warnings during the build, but the unit tests would not run on the
> results -- complaining of missing modules.
>
> So I built again using a freshly unpacked code directory and that worked
> just fine.
>
> I'm pretty sure I've seen this problem before, but keep forgetting to
> ask about it.
>
> Is this a bug somewhere (e.g. in matplotlib's setup.py or somewhere in
> python) or is there some better way to clear out a python code directory?
>
Yes! I'm sending you a virtual high five! Thanks for thy Russell.
-- 
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Eric F. <ef...@ha...> - 2012年10月30日 21:39:37
On 2012年10月29日 2:00 PM, Mike Kaufman wrote:
> On 10/29/12 1:08 PM, Jody Klymak wrote:
>>
>> On Oct 28, 2012, at 17:47 PM, Eric Firing <ef...@ha...> wrote:
>>>
>>> cb = colorbar()
>>> cb.solids.set_rasterized(True)
>>
>>
>> Great! Though I think it'd have taken me a while to figure that one out!
>
> I gotta agree. Is this (and the solids object) documented anywhere?
No, and it probably won't be any time soon. Rasterization here is a 
last resort work-around for buggy pdf renderers. The solids object is 
mentioned in the colorbar docstring as something one can modify for such 
workarounds (an alternative is given), but perhaps without saying what 
kind of a thing it is.
Eric
>
> M
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Michael D. <md...@st...> - 2012年10月30日 17:52:48
On 10/30/2012 12:25 PM, Brandon Heller wrote:
> Hi Phil,
>
> Next time I'll be more explicit. I added the question to SA after I 
> tried to get a public link to my message and saw that archives past 
> July of this year seem to be missing. It wasn't clear that this list 
> was even still alive:
> http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users
>
> Any idea why the archives seem to have stopped?
Thanks for pointing that out. I'm not sure what's wrong, but I'll look 
into it.
Mike
>
> Thanks,
> Brandon
>
> On Tue, Oct 30, 2012 at 2:23 AM, Phil Elson <pel...@gm... 
> <mailto:pel...@gm...>> wrote:
>
> Hi Brandon,
>
> I notice that this is cross-posted on StackOverflow
> (http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
> Personally, I have no problem with cross posting, but to save two
> people having to answer the same question, I would make sure it
> was explicit that this had also been posted elsewhere.
>
> Thanks,
>
> Phil
>
>
> On 30 October 2012 03:13, Brandon Heller <bra...@st...
> <mailto:bra...@st...>> wrote:
>
> Hi,
>
> I'm trying to use Matplotlib graphs as part of a camera-ready
> submission, and the publishing house requires the use of Type
> 1 fonts
> only.
>
> I'm finding that the PDF backend happily outputs Type-1 fonts for
> simple graphs with linear Y axes, but outputs Type-3 fonts for
> logarithmic Y axes.
>
> Using a logarithmic yscale incurs the use of mathtext, which
> seems to
> use Type 3 fonts, presumably because of the default use of
> exponential
> notation. I can use an ugly hack to get around this - using
> pyplot.yticks() to force the axis ticks to not use exponents - but
> this would require moving the plot region to accommodate large
> labels
> (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they
> fit.
>
> There's a minimum working example below, which I've tested
> with the
> matplotlib master branch as of today, as well as 1.1.1, which
> produces
> the same behavior, so I don't know that this is a bug,
> probably just
> unexpected behavior.
>
>
> #!/usr/bin/env python
> # Simple program to test for type 1 fonts.
> # Generate a line graph w/linear and log Y axes.
>
> from matplotlib import rc, rcParams
>
> #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> # These lines are needed to get type-1 results:
> #
> http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
> rcParams['ps.useafm'] = True
> rcParams['pdf.use14corefonts'] = True
> rcParams['text.usetex'] = False
>
> import matplotlib.pyplot as plt
>
> YSCALES = ['linear', 'log']
>
> def plot(filename, yscale):
> plt.figure(1)
> xvals = range(1, 2)
> yvals = xvals
> plt.plot(xvals, yvals)
> plt.yscale(yscale)
> #YTICKS = [1, 10]
> #plt.yticks(YTICKS, YTICKS) # locs, labels
> ax = plt.gca()
> #print ax.get_xticklabels()[0].get_text()
> print ",".join([a.get_label() for a in ax.get_yticklabels()])
> plt.savefig(filename + '.pdf')
>
>
> if __name__ == '__main__':
> for yscale in YSCALES:
> plot('linegraph-' + yscale, yscale)
>
>
>
> Does anyone know a clean way to get Type 1 fonts with log axes?
>
> Thanks,
> Brandon
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Brandon H. <bra...@st...> - 2012年10月30日 17:06:18
On Tue, Oct 30, 2012 at 5:51 AM, Michael Droettboom <md...@st...> wrote:
> There are a couple of alternative formatters for log scaling that don't
> require mathtext.
>
> You can do:
>
> from matplotlib.tickers import LogFormatter, LogFormatterExponent
> ...
> ax.xaxis.set_major_formatter(LogFormatter())
> # or LogFormatterExponent(), which is just the exponent
>
>
To clarify the font issue. The PDF backend has no support for outputting
> Type 1 fonts. There is an rcParam "pdf.fonttype" that allows you to choose
> between Type 3 and Type 42 fonts, however. Type 3 stores each character as
> a path and then uses those to put strings together. It supports font
> subsetting, so an entire large font is not embedded in the file. Type 42
> (essentially) just embeds a TrueType font in the file, and we don't support
> subsetting there.
>
> There is also the "pdf.use14corefonts" that will use the 14 built-in PDF
> fonts whenever possible (and therefore not embed any fonts). However,
> mathtext requires a special font for the math symbols, and thus it starts
> to embed fonts.
>
> You may try setting "mathtext.default" to "regular", which will use the
> font used as the default for the rest of the text first. This should have
> the effect of not embedding any extra fonts in the file as long as you
> don't use any special symbols in the math.
>
Hi Mike,
Thanks for the suggestions - I tried both. The first (use a LogFormatter)
yields only Type 1 but doesn't look look as good as exponential notation
(my style preference). The second (mathtext.default = regular) defaulted
to CMR and kept the exponents as Type 1, but not the helvetica used by the
rest of the graph. It used CMR even when I had set another font as the
default:
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
... so maybe I'm not setting the default properly. Any ideas there?
A suggestion from my colleague Vimal Kumar was to post-process the output
to replace Type3 w/Type 1:
 sed -i.bak \
 -e "s/Type3/Type1/g" \
 -e "s/BitstreamVeraSans-Roman/Helvetica/g" \
 -e "s/DejaVuSans/Helvetica/g" \
 $file
This has the advantage that no mattext or tex is required, though I have to
assume the letter spacing is meant for the original font. In practice, the
only replaced fonts are on the Y axis, so even if the spacing between
letters seems a bit bigger, I don't think this is a huge issue. Of course,
it would still be nice to solve this problem in MPL itself, though.
Thanks,
Brandon
>
> Mike
>
>
> On 10/30/2012 05:23 AM, Phil Elson wrote:
>
> Hi Brandon,
>
> I notice that this is cross-posted on StackOverflow (
> http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
> Personally, I have no problem with cross posting, but to save two people
> having to answer the same question, I would make sure it was explicit that
> this had also been posted elsewhere.
>
> Thanks,
>
> Phil
>
>
> On 30 October 2012 03:13, Brandon Heller <bra...@st...> wrote:
>
>> Hi,
>>
>> I'm trying to use Matplotlib graphs as part of a camera-ready
>> submission, and the publishing house requires the use of Type 1 fonts
>> only.
>>
>> I'm finding that the PDF backend happily outputs Type-1 fonts for
>> simple graphs with linear Y axes, but outputs Type-3 fonts for
>> logarithmic Y axes.
>>
>> Using a logarithmic yscale incurs the use of mathtext, which seems to
>> use Type 3 fonts, presumably because of the default use of exponential
>> notation. I can use an ugly hack to get around this - using
>> pyplot.yticks() to force the axis ticks to not use exponents - but
>> this would require moving the plot region to accommodate large labels
>> (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.
>>
>> There's a minimum working example below, which I've tested with the
>> matplotlib master branch as of today, as well as 1.1.1, which produces
>> the same behavior, so I don't know that this is a bug, probably just
>> unexpected behavior.
>>
>>
>> #!/usr/bin/env python
>> # Simple program to test for type 1 fonts.
>> # Generate a line graph w/linear and log Y axes.
>>
>> from matplotlib import rc, rcParams
>>
>> #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>>
>> # These lines are needed to get type-1 results:
>> #
>> http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
>> rcParams['ps.useafm'] = True
>> rcParams['pdf.use14corefonts'] = True
>> rcParams['text.usetex'] = False
>>
>> import matplotlib.pyplot as plt
>>
>> YSCALES = ['linear', 'log']
>>
>> def plot(filename, yscale):
>> plt.figure(1)
>> xvals = range(1, 2)
>> yvals = xvals
>> plt.plot(xvals, yvals)
>> plt.yscale(yscale)
>> #YTICKS = [1, 10]
>> #plt.yticks(YTICKS, YTICKS) # locs, labels
>> ax = plt.gca()
>> #print ax.get_xticklabels()[0].get_text()
>> print ",".join([a.get_label() for a in ax.get_yticklabels()])
>> plt.savefig(filename + '.pdf')
>>
>>
>> if __name__ == '__main__':
>> for yscale in YSCALES:
>> plot('linegraph-' + yscale, yscale)
>>
>>
>>
>> Does anyone know a clean way to get Type 1 fonts with log axes?
>>
>> Thanks,
>> Brandon
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:http://p.sf.net/sfu/appdyn_sfd2d_oct
>
>
>
> _______________________________________________
> Matplotlib-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Brandon H. <bra...@st...> - 2012年10月30日 16:25:56
Hi Phil,
Next time I'll be more explicit. I added the question to SA after I tried
to get a public link to my message and saw that archives past July of this
year seem to be missing. It wasn't clear that this list was even still
alive:
http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users
Any idea why the archives seem to have stopped?
Thanks,
Brandon
On Tue, Oct 30, 2012 at 2:23 AM, Phil Elson <pel...@gm...> wrote:
> Hi Brandon,
>
> I notice that this is cross-posted on StackOverflow (
> http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
> Personally, I have no problem with cross posting, but to save two people
> having to answer the same question, I would make sure it was explicit that
> this had also been posted elsewhere.
>
> Thanks,
>
> Phil
>
>
> On 30 October 2012 03:13, Brandon Heller <bra...@st...> wrote:
>
>> Hi,
>>
>> I'm trying to use Matplotlib graphs as part of a camera-ready
>> submission, and the publishing house requires the use of Type 1 fonts
>> only.
>>
>> I'm finding that the PDF backend happily outputs Type-1 fonts for
>> simple graphs with linear Y axes, but outputs Type-3 fonts for
>> logarithmic Y axes.
>>
>> Using a logarithmic yscale incurs the use of mathtext, which seems to
>> use Type 3 fonts, presumably because of the default use of exponential
>> notation. I can use an ugly hack to get around this - using
>> pyplot.yticks() to force the axis ticks to not use exponents - but
>> this would require moving the plot region to accommodate large labels
>> (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.
>>
>> There's a minimum working example below, which I've tested with the
>> matplotlib master branch as of today, as well as 1.1.1, which produces
>> the same behavior, so I don't know that this is a bug, probably just
>> unexpected behavior.
>>
>>
>> #!/usr/bin/env python
>> # Simple program to test for type 1 fonts.
>> # Generate a line graph w/linear and log Y axes.
>>
>> from matplotlib import rc, rcParams
>>
>> #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>>
>> # These lines are needed to get type-1 results:
>> #
>> http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
>> rcParams['ps.useafm'] = True
>> rcParams['pdf.use14corefonts'] = True
>> rcParams['text.usetex'] = False
>>
>> import matplotlib.pyplot as plt
>>
>> YSCALES = ['linear', 'log']
>>
>> def plot(filename, yscale):
>> plt.figure(1)
>> xvals = range(1, 2)
>> yvals = xvals
>> plt.plot(xvals, yvals)
>> plt.yscale(yscale)
>> #YTICKS = [1, 10]
>> #plt.yticks(YTICKS, YTICKS) # locs, labels
>> ax = plt.gca()
>> #print ax.get_xticklabels()[0].get_text()
>> print ",".join([a.get_label() for a in ax.get_yticklabels()])
>> plt.savefig(filename + '.pdf')
>>
>>
>> if __name__ == '__main__':
>> for yscale in YSCALES:
>> plot('linegraph-' + yscale, yscale)
>>
>>
>>
>> Does anyone know a clean way to get Type 1 fonts with log axes?
>>
>> Thanks,
>> Brandon
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
From: Brickle M. <bri...@gm...> - 2012年10月30日 14:40:41
For some fun I am trying to plot a surface representation of 2D image 
where the height level corresponds to the intensity at each pixel. I 
have been able to change the cmap but would like to assign the original 
pixel colour values (Grayscale or RGB) to corresponding in the surface 
plot. Is this possible? To be honest, I not even sure if I have 
constructed the plot correctly.
Any help appreciated.
Regards,
Brickle.
----
----- Surface Representation of 2D Image --------
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from skimage import data, color
import numpy as np
from scipy import ndimage
from matplotlib import cm
image = color.rgb2gray(data.lena())
image = ndimage.gaussian_filter(image, 8)
x = range(image.shape[0])
y = range(image.shape[1])
X,Y = np.meshgrid(x,y) # Is this the correct way?
Z = image # Not sure if this is correct?
fig = plt.figure()
ax = fig.add_subplot(1,1,1, projection='3d')
ax.plot_surface(X,Y,Z, cmap=cm.gray)
plt.show()
----------------------------------------------
From: Michael D. <md...@st...> - 2012年10月30日 12:51:41
There are a couple of alternative formatters for log scaling that don't 
require mathtext.
You can do:
from matplotlib.tickers import LogFormatter, LogFormatterExponent
...
ax.xaxis.set_major_formatter(LogFormatter())
# or LogFormatterExponent(), which is just the exponent
To clarify the font issue. The PDF backend has no support for 
outputting Type 1 fonts. There is an rcParam "pdf.fonttype" that allows 
you to choose between Type 3 and Type 42 fonts, however. Type 3 stores 
each character as a path and then uses those to put strings together. 
It supports font subsetting, so an entire large font is not embedded in 
the file. Type 42 (essentially) just embeds a TrueType font in the 
file, and we don't support subsetting there.
There is also the "pdf.use14corefonts" that will use the 14 built-in PDF 
fonts whenever possible (and therefore not embed any fonts). However, 
mathtext requires a special font for the math symbols, and thus it 
starts to embed fonts.
You may try setting "mathtext.default" to "regular", which will use the 
font used as the default for the rest of the text first. This should 
have the effect of not embedding any extra fonts in the file as long as 
you don't use any special symbols in the math.
Mike
On 10/30/2012 05:23 AM, Phil Elson wrote:
> Hi Brandon,
>
> I notice that this is cross-posted on StackOverflow 
> (http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
> Personally, I have no problem with cross posting, but to save two 
> people having to answer the same question, I would make sure it was 
> explicit that this had also been posted elsewhere.
>
> Thanks,
>
> Phil
>
>
> On 30 October 2012 03:13, Brandon Heller <bra...@st... 
> <mailto:bra...@st...>> wrote:
>
> Hi,
>
> I'm trying to use Matplotlib graphs as part of a camera-ready
> submission, and the publishing house requires the use of Type 1 fonts
> only.
>
> I'm finding that the PDF backend happily outputs Type-1 fonts for
> simple graphs with linear Y axes, but outputs Type-3 fonts for
> logarithmic Y axes.
>
> Using a logarithmic yscale incurs the use of mathtext, which seems to
> use Type 3 fonts, presumably because of the default use of exponential
> notation. I can use an ugly hack to get around this - using
> pyplot.yticks() to force the axis ticks to not use exponents - but
> this would require moving the plot region to accommodate large labels
> (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.
>
> There's a minimum working example below, which I've tested with the
> matplotlib master branch as of today, as well as 1.1.1, which produces
> the same behavior, so I don't know that this is a bug, probably just
> unexpected behavior.
>
>
> #!/usr/bin/env python
> # Simple program to test for type 1 fonts.
> # Generate a line graph w/linear and log Y axes.
>
> from matplotlib import rc, rcParams
>
> #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> # These lines are needed to get type-1 results:
> #
> http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
> rcParams['ps.useafm'] = True
> rcParams['pdf.use14corefonts'] = True
> rcParams['text.usetex'] = False
>
> import matplotlib.pyplot as plt
>
> YSCALES = ['linear', 'log']
>
> def plot(filename, yscale):
> plt.figure(1)
> xvals = range(1, 2)
> yvals = xvals
> plt.plot(xvals, yvals)
> plt.yscale(yscale)
> #YTICKS = [1, 10]
> #plt.yticks(YTICKS, YTICKS) # locs, labels
> ax = plt.gca()
> #print ax.get_xticklabels()[0].get_text()
> print ",".join([a.get_label() for a in ax.get_yticklabels()])
> plt.savefig(filename + '.pdf')
>
>
> if __name__ == '__main__':
> for yscale in YSCALES:
> plot('linegraph-' + yscale, yscale)
>
>
>
> Does anyone know a clean way to get Type 1 fonts with log axes?
>
> Thanks,
> Brandon
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Phil E. <pel...@gm...> - 2012年10月30日 09:23:12
Hi Brandon,
I notice that this is cross-posted on StackOverflow (
http://stackoverflow.com/questions/13132194/type-1-fonts-with-log-graphs).
Personally, I have no problem with cross posting, but to save two people
having to answer the same question, I would make sure it was explicit that
this had also been posted elsewhere.
Thanks,
Phil
On 30 October 2012 03:13, Brandon Heller <bra...@st...> wrote:
> Hi,
>
> I'm trying to use Matplotlib graphs as part of a camera-ready
> submission, and the publishing house requires the use of Type 1 fonts
> only.
>
> I'm finding that the PDF backend happily outputs Type-1 fonts for
> simple graphs with linear Y axes, but outputs Type-3 fonts for
> logarithmic Y axes.
>
> Using a logarithmic yscale incurs the use of mathtext, which seems to
> use Type 3 fonts, presumably because of the default use of exponential
> notation. I can use an ugly hack to get around this - using
> pyplot.yticks() to force the axis ticks to not use exponents - but
> this would require moving the plot region to accommodate large labels
> (like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.
>
> There's a minimum working example below, which I've tested with the
> matplotlib master branch as of today, as well as 1.1.1, which produces
> the same behavior, so I don't know that this is a bug, probably just
> unexpected behavior.
>
>
> #!/usr/bin/env python
> # Simple program to test for type 1 fonts.
> # Generate a line graph w/linear and log Y axes.
>
> from matplotlib import rc, rcParams
>
> #rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> # These lines are needed to get type-1 results:
> #
> http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
> rcParams['ps.useafm'] = True
> rcParams['pdf.use14corefonts'] = True
> rcParams['text.usetex'] = False
>
> import matplotlib.pyplot as plt
>
> YSCALES = ['linear', 'log']
>
> def plot(filename, yscale):
> plt.figure(1)
> xvals = range(1, 2)
> yvals = xvals
> plt.plot(xvals, yvals)
> plt.yscale(yscale)
> #YTICKS = [1, 10]
> #plt.yticks(YTICKS, YTICKS) # locs, labels
> ax = plt.gca()
> #print ax.get_xticklabels()[0].get_text()
> print ",".join([a.get_label() for a in ax.get_yticklabels()])
> plt.savefig(filename + '.pdf')
>
>
> if __name__ == '__main__':
> for yscale in YSCALES:
> plot('linegraph-' + yscale, yscale)
>
>
>
> Does anyone know a clean way to get Type 1 fonts with log axes?
>
> Thanks,
> Brandon
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Brandon H. <bra...@st...> - 2012年10月30日 03:13:25
Hi,
I'm trying to use Matplotlib graphs as part of a camera-ready
submission, and the publishing house requires the use of Type 1 fonts
only.
I'm finding that the PDF backend happily outputs Type-1 fonts for
simple graphs with linear Y axes, but outputs Type-3 fonts for
logarithmic Y axes.
Using a logarithmic yscale incurs the use of mathtext, which seems to
use Type 3 fonts, presumably because of the default use of exponential
notation. I can use an ugly hack to get around this - using
pyplot.yticks() to force the axis ticks to not use exponents - but
this would require moving the plot region to accommodate large labels
(like 10 ^ 6) or writing the axes as 10, 100, 1K, etc. so they fit.
There's a minimum working example below, which I've tested with the
matplotlib master branch as of today, as well as 1.1.1, which produces
the same behavior, so I don't know that this is a bug, probably just
unexpected behavior.
#!/usr/bin/env python
# Simple program to test for type 1 fonts.
# Generate a line graph w/linear and log Y axes.
from matplotlib import rc, rcParams
#rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
# These lines are needed to get type-1 results:
# http://nerdjusttyped.blogspot.com/2010/07/type-1-fonts-and-matplotlib-figures.html
rcParams['ps.useafm'] = True
rcParams['pdf.use14corefonts'] = True
rcParams['text.usetex'] = False
import matplotlib.pyplot as plt
YSCALES = ['linear', 'log']
def plot(filename, yscale):
 plt.figure(1)
 xvals = range(1, 2)
 yvals = xvals
 plt.plot(xvals, yvals)
 plt.yscale(yscale)
 #YTICKS = [1, 10]
 #plt.yticks(YTICKS, YTICKS) # locs, labels
 ax = plt.gca()
 #print ax.get_xticklabels()[0].get_text()
 print ",".join([a.get_label() for a in ax.get_yticklabels()])
 plt.savefig(filename + '.pdf')
if __name__ == '__main__':
 for yscale in YSCALES:
 plot('linegraph-' + yscale, yscale)
Does anyone know a clean way to get Type 1 fonts with log axes?
Thanks,
Brandon
From: Mike K. <mc...@gm...> - 2012年10月30日 00:00:18
On 10/29/12 1:08 PM, Jody Klymak wrote:
>
> On Oct 28, 2012, at 17:47 PM, Eric Firing <ef...@ha...> wrote:
>>
>> cb = colorbar()
>> cb.solids.set_rasterized(True)
>
>
> Great! Though I think it'd have taken me a while to figure that one out!
I gotta agree. Is this (and the solids object) documented anywhere?
M

Showing 10 results of 10

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 によって変換されたページ (->オリジナル) /