SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





1
(12)
2
(13)
3
(4)
4
(34)
5
(14)
6
(23)
7
(26)
8
(12)
9
(7)
10
(7)
11
(9)
12
(12)
13
(20)
14
(14)
15
(13)
16
(5)
17
(4)
18
(22)
19
(29)
20
(13)
21
(9)
22
(22)
23
(3)
24
(3)
25
(29)
26
(9)
27
(10)
28
(16)
29
(16)
30
(16)
31
(9)






Showing 9 results of 9

From: Michael D. <md...@st...> - 2010年10月11日 16:31:55
On 10/10/2010 03:13 PM, Benoit Gaillard wrote:
> Hi,
>
> How can one display Mandarin labels in a plot, as yticks_labels for 
> example?
> It looks to me that there is no font in matplotlib that can display 
> Chinese
> characters? I can display accentuation from 'utf8' but i could not find a
> font family that would display Chinese characters.
>
> Here is an example of plot that displays empty boxes instead of Chinese
> characters. In comments you can see various failed attempts:
>
> import matplotlib as mpl
> from matplotlib import cm
> from matplotlib import rc
> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']})
> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial']
> import matplotlib.pyplot as plt
>
> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]]
> fig = plt.figure()
> axim = fig.add_subplot(111)
> #ytics: caractères chinois en utf8
> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')]
> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')]
> axim.imshow(matrix, cmap=cm.jet, interpolation='nearest',origin='lower')
> axim.set_xticks(range(2)) 
> axim.set_xticklabels(xtics,fontsize=15,rotation=25,ha='right',family='monospace') 
>
> axim.set_yticks(range(2))
> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR 
> PL ungtiL GB')
> plt.show()
>
> Thank you for your help,
>
> Benoit
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
>
> Hi,
>
> How can one display mandarin labels in a plot, as yticks_labels for 
> example? It looks to me that there is no font in matplotlib that can 
> display chinese characters? I can display accentuation from 'utf8' but 
> i could not find a font family that would display chinese characters.
>
> Here is an example of plot that displays empty boxes instead of 
> chinese characters. In comment you can see various failed attempts:
>
> import matplotlib as mpl
> from matplotlib import cm
> from matplotlib import rc
> #rc('font',**{'family':'sans-serif','sans-serif':['SimHei','Arial']})
> #mpl.rcParams['font.sans-serif'] = ['SimHei','Arial']
> import matplotlib.pyplot as plt
>
> matrix=[[skey+tkey for skey in [1,2]] for tkey in [1,2]]
> fig = plt.figure()
> axim = fig.add_subplot(111)
> #ytics: caractères chinois en utf8
> ytics=['\xe6\x8a\xb1'.decode('utf8'),'\xe6\x93\x81'.decode('utf8')]
> 
> xtics=['d\xc3\xa9bo\xc3\xaeter'.decode('utf8'),'diviser'.decode('utf8')]
> axim.imshow(matrix, cmap=cm.jet, interpolation='nearest', 
> origin='lower')
> axim.set_xticks(range(2))
> axim.set_xticklabels(xtics, 
> fontsize=15,rotation=25,ha='right',family='monospace')
> axim.set_yticks(range(2))
> 
> axim.set_yticklabels(ytics,fontsize=15,family='fantasy')#,fontname='AR 
> PL SungtiL GB')
Why are you setting the font family to "monospace" and "fantasy" here? 
You need to set the font to something that will have the Chinese 
characters, for example, by uncommenting the lines that set sans-serif 
to "SimHei" above. (That should work, but I don't have a Chinese font 
on my system to test with.)
Mike
> plt.show()
>
> Thank you for your help,
>
> Benoit
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Peter B. <bu...@gm...> - 2010年10月11日 16:30:28
Hi Alessio,
Thank you for the sqlite code example.
What have been the key advantages of using a Database over a
structured array for your applications ?
http://docs.python.org/library/sqlite3.html :
SQLite is a C library that provides a lightweight disk-based database
that doesn’t require a separate server process and allows accessing
the database using a nonstandard variant of the SQL query language.
On Sun, Oct 10, 2010 at 12:56 PM, Peter Butterworth <bu...@gm...> wrote:
> Hi,
>
>
> To load csv data, I use a modified version of csv2rec for which the
> data type of each column is specified explicitly in the data file.
> By removing the dtype guessing you get a speedup and you also avoid
> potential mess-ups.
>
>
> Alessio: sadly you right about it not being possible to trust Excel with data.
> Could you please give more details on the sqlite method you suggest ?
>
>
> --
>>> by Alessio Civ Oct 10, 2010; 09:04am:
> Hi,
>
> a strong advice from someone who is using excel format with tons of
> data is to save them in csv and then import in Sqlite.
>
> Excel messes up the data types and gives a lot of troubles with
> numbers. Sqlite is fast and data are secure.
> The power of this system is that you can query your data and plot what
> you need for example.
>
> I can share with you my script to import from csv to sqlite if you want.
>
>
> --
> thanks,
> peter butterworth
>
-- 
thanks,
peter butterworth
From: Benjamin R. <ben...@ou...> - 2010年10月11日 16:19:03
On Sun, Oct 10, 2010 at 8:54 PM, Burak TUYSUZ <bz...@ps...> wrote:
>
> I am trying to show the numbers at x and y axis in scientific notation but
> it does not work.
> Can anyone help me.
> Thank you in advance.
> Here is the code and fs is 60 000 000.
>
>
> from matplotlib.ticker import ScalarFormatter
> formatter = ScalarFormatter(useMathText=True)
> formatter.set_scientific(True)
> formatter.set_powerlimits((-1,3))
>
> fig1 = plt.figure()
> ax1 = fig1.gca(projection='3d', azim=0)
> ax1.xaxis.set_major_formatter(formatter)
> ax1.yaxis.set_major_formatter(formatter)
>
> tau_val, freq_val = npy.meshgrid(npy.float64(tau_val)/fs,
> npy.float64(freq_val)*fs)
> ax1.plot_surface(tau_val, freq_val, caf, rstride=1, cstride=1,
> cmap=cm.jet, linewidth=0, antialiased=False)
>
> plt.show()
>
>
Burak,
This is because in an Axes3D object, the .xaxis and .yaxis refer to the axis
for the draw space, not the the 3d projected axis. I know it is confusing,
but the axis objects that you want are called ".w_xaxis" and ".w_yaxis" and
".w_zaxis".
I hope that helps!
Ben Root
From: Peter B. <bu...@gm...> - 2010年10月11日 16:08:02
Hi,
I believe it is not currently possible to change the toolbar in a
backend independent manner. I do agree it would be a nice feature
though.
I think it would be possible to change the toolbar without embedding
with a syntax not all that different from the one you suggest.
In the figure window, the toolbar is displayed by the FigureManager(
FigureManagerBase), you'll find the related code in the backend file
and you can gain access to the FigureManager through the figure
instance.
Please share the code for your annotation toolbar once it is
completed, I'm sure I could find use for it.
---------------
>> by Bartosz Telenczuk Oct 11, 2010; 11:44am
Dear all,
I am working on a custom toolbar with annotation tools (such as
arrows, text etc.) which would be a replacement or addition to the
standard navigation toolbar usually available at the bottom of the
figure window.
So far in order to add the toolbar I use the example
embedding_in_gtk2.py. Unfortunately this works only with gtk backends.
Is there a way to add the toolbar to the window in a
backend-independent way? For example, the following syntax would be
very convenient:
fig = figure()
tbar = NavigationToolbar()
fig.add_toolbar(tbar)
With such an API one could define on the runtime which toolbar should
be avialable. Adding multiple toolbar would be also possible.
Yours,
Bartosz
Bartosz Telenczuk
Institute for Theoretical Biology
Humboldt University of Berlin
Germany
http://neuroscience.telenczuk.pl
-- 
thanks,
peter butterworth
From: Michael D. <md...@st...> - 2010年10月11日 15:03:14
You have a choice of the built-in math layout engine (mathtext) and 
using the real LaTeX for this. The rcParam "text.usetex", when True, 
will use LaTeX.
I'm not sure I fully understand the question, though. To get the Greek 
alpha character, Unicode will be used in the output. You've 
demonstrated that you don't have to use Unicode in the input, however, 
as you can say "$\alpha_0$". What is it you're trying to avoid?
Mike
On 10/11/2010 10:57 AM, Ruggero wrote:
> Hello, how I can write a simple formula like this: $\alpha_0$ without
> latex using unicode? My problem is how to write sub(super)script.
> Thanks.
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Ruggero <giu...@gm...> - 2010年10月11日 14:58:23
Hello, how I can write a simple formula like this: $\alpha_0$ without
latex using unicode? My problem is how to write sub(super)script.
Thanks.
From: Bartosz T. <b.t...@bi...> - 2010年10月11日 09:44:37
Dear all,
I am working on a custom toolbar with annotation tools (such as arrows, text etc.) which would be a replacement or addition to the standard navigation toolbar usually available at the bottom of the figure window. 
So far in order to add the toolbar I use the example embedding_in_gtk2.py. Unfortunately this works only with gtk backends. Is there a way to add the toolbar to the window in a backend-independent way? For example, the following syntax would be very convenient:
fig = figure()
tbar = NavigationToolbar()
fig.add_toolbar(tbar)
With such an API one could define on the runtime which toolbar should be avialable. Adding multiple toolbar would be also possible.
Yours,
Bartosz
Bartosz Telenczuk
Institute for Theoretical Biology
Humboldt University of Berlin
Germany
http://neuroscience.telenczuk.pl
From: Alessio C. <via...@gm...> - 2010年10月11日 06:29:21
Thanks Goyo and Jae-Joon Lee.
It worked!
it worked!
Goyo wrote:
> 
> 2010年10月10日 Alessio Civ <via...@gm...>:
>>
>>
>> Please, can someone help me? I've been digging the documentation, but I
>> can't find a way to do this.
> 
> ¿Didn't you get my message on oct-5? I didn't send it to the list by
> mistake:
> 
> --%<----------------------------------------------------------------------------
> Make your variables numpy arrays and slice them using values in z:
> 
> x = np.array([1, 2, 3, 4])
> y = np.array([2, 3, 4, 5])
> z = np.array([0, 1, 0, 1])
> 
> x0 = x[z == 0]
> y0 = y[z == 1]
> x1 = x[z == 0]
> y1 = y[z == 1]
> 
> plt.scatter(x0, y0, c='b')
> plt.scatter(x1, y1, c='r')
> 
> --%<------------------------------------------------------------------------
> 
> See the attached example, you can run it as a script or import it as a
> module and use the function multi_scatter in your code.
> 
> Goyo
> 
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Scatter-Plot-with-different-colors-tp29887701p29931461.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Burak T. <bz...@ps...> - 2010年10月11日 01:54:57
I am trying to show the numbers at x and y axis in scientific notation but
it does not work.
Can anyone help me.
Thank you in advance.
Here is the code and fs is 60 000 000.
 from matplotlib.ticker import ScalarFormatter
 formatter = ScalarFormatter(useMathText=True)
 formatter.set_scientific(True)
 formatter.set_powerlimits((-1,3))
 fig1 = plt.figure()
 ax1 = fig1.gca(projection='3d', azim=0)
 ax1.xaxis.set_major_formatter(formatter)
 ax1.yaxis.set_major_formatter(formatter)
 tau_val, freq_val = npy.meshgrid(npy.float64(tau_val)/fs,
npy.float64(freq_val)*fs)
 ax1.plot_surface(tau_val, freq_val, caf, rstride=1, cstride=1,
cmap=cm.jet, linewidth=0, antialiased=False)
 plt.show()

Showing 9 results of 9

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